diff --git a/docs/docs/deployment/hosting/locally-edge-proxy.md b/docs/docs/deployment/hosting/locally-edge-proxy.md index 6b48598b8a37..7aa7c9d985d6 100644 --- a/docs/docs/deployment/hosting/locally-edge-proxy.md +++ b/docs/docs/deployment/hosting/locally-edge-proxy.md @@ -151,6 +151,27 @@ Optionally, specify the LRU cache size with `cache_max_size`. Defaults to 128. } ``` +### Server settings + +#### `server.proxy_headers` + +When set to `true`, the Edge Proxy will use the `X-Forwarded-For` and `X-Forwarded-Proto` HTTP headers to determine +client IP addresses. This is useful if the Edge Proxy is running behind a reverse proxy, and you want the +[access logs](#logging.override) to show the real IP addresses of your clients. + +By default, only the loopback address is trusted. This can be changed with the [`FORWARDED_ALLOW_IPS` environment +variable](#environment-variables). + +```json +"server": { + "proxy_headers": true +} +``` + +``` +SERVER_PROXY_HEADERS=true +``` + ### Logging #### `logging.log_level` @@ -286,3 +307,5 @@ Some Edge Proxy settings can only be set using environment variables: - `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`: These variables let you configure an HTTP proxy that the Edge Proxy should use for all its outgoing HTTP requests. [Learn more](https://www.python-httpx.org/environment_variables) +- `FORWARDED_ALLOW_IPS`: Which IPs to trust for determining client IP addresses when using the `proxy_headers` option. + For more details, see the [Uvicorn documentation](https://www.uvicorn.org/settings/#http).