diff --git a/services/api/src/middleware/ratelimit.rs b/services/api/src/middleware/ratelimit.rs index ceec27e3..0c7f4412 100644 --- a/services/api/src/middleware/ratelimit.rs +++ b/services/api/src/middleware/ratelimit.rs @@ -62,7 +62,7 @@ pub async fn do_request_ratelimited( ) -> Response { if let Some(redis) = redis { let headers = request.headers().clone(); - let source_ip = header_or_unknown(headers.get("Fly-Client-IP")); + let source_ip = header_or_unknown(headers.get("X-PluralKit-Client-IP")); // https://github.com/rust-lang/rust/issues/53667 let (rl_key, rate) = if let Some(header) = request.headers().clone().get("X-PluralKit-App") diff --git a/services/web-proxy/main.go b/services/web-proxy/main.go index 7ab6e54b..b8c5d971 100644 --- a/services/web-proxy/main.go +++ b/services/web-proxy/main.go @@ -37,6 +37,9 @@ func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) { return } + r.Header.Del("X-PluralKit-Client-IP") + r.Header.Set("X-PluralKit-Client-IP", r.Header.Get("Fly-Client-IP")) + startTime := time.Now() r = r.WithContext(context.WithValue(r.Context(), "req-time", startTime))