Ever found yourself wondering why your nginx setup is returning a port from the backend vhost?
QUICK FIX: port_in_redirect off;
I found some tweaks to prevent this from happening, first a example:
# This is the result of a: try $uri $uri/ in a backend vhost stein@stein ~ $ curl --head http://www.example.nl/test HTTP/1.1 301 Moved Permanently Server: nginx Content-Type: text/html Content-Length: 178 Connection: keep-alive Location: http://www.example.nl:8080/test/ Accept-Ranges: bytes X-Varnish: 1044342160 Age: 0 Via: 1.