how are port number in $host handled if I specify $host:<port number>

SW@EU ente.trompete at
Tue May 22 15:59:01 UTC 2018

if I read the Module ngx_http_proxy_module documentation I will find e.g. an possible header rewrite in this way

proxy_set_header Host       $host:$proxy_port;

but what would happens here if $host contains already a port number because the server does not listen on a default port. Maybe the server is listening on port 8080 but  $proxy_port is 8081. Is the header then "Host: $hostname:8080:8081" or has nginx an automatic in this case that the port part is removed from $host if a port is separately specified? The same question for $proxy_host:<port number> and  $proxy_host contains already a port number.
Unfortunately  I don't find any information about variable handling in nginx :-(.


Sent with [ProtonMail]( Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list