How to configure nginx X-Forwarded-Port to be the originally request port
The only workaround I’ve found is to use a map rule to get the port from the http_host variable e.g. map $http_host $port { default 80; “~^[^\:]+:(?<p>\d+)$” $p; }
The only workaround I’ve found is to use a map rule to get the port from the http_host variable e.g. map $http_host $port { default 80; “~^[^\:]+:(?<p>\d+)$” $p; }
request.client should work, unless you’re running behind a proxy (e.g. nginx) in that case use uvicorn’s –proxy-headers flag to accept these incoming headers and make sure the proxy forwards them.