Unfortunately, nginx’s online documentation doesn’t tell about where and when that number is stripped. It just says that it takes $host from the request’s Host: entry, which isn’t correct.
Which variable would I have to use to keep that port :7777 as given in the request’s Host: entry?
Where are you doing the port translation? If it’s being done at the podman level, NGINX is likely not seeing the request to port 7777 at all. Have you tried using the NGINX unprivileged image instead?
On 10/6/25 13:30, Alessandro Fael Garcia via NGINX Community Forum wrote:
Where are you doing the port translation? If it’s being done at the
podman level, NGINX is likely not seeing the request to port 7777 at
all. Have you tried using the NGINX unprivileged image instead?
Yes, of course, it is the podman proxy (or, depending how you start it,
iptables/nftables), which translates port 7777 to port 80.
But that’s not the point.
Podman and iptables do translate the port on layer 4, *but they do not
change the contents of a TCP connection, especially not the HTTP
request. *So even if nginx running inside the docker image binds to port
80 and sees connections to port 80 on the TCP layer (layer 4 in the
layer model), The HTTP request still contains
and the nginx docs claim, that the $host variable is take from the
request.So the question is: How can I use the port number given in the
Host: entry in the request for redirects?
BTW, Wordpress running in php behind nginx is correctly redirecting to
port 7777, so the information about port 7777 even goes through nginx.