With this setup, Nginx will keep the port in your redirections, no matter you firewall configuration. replace proxy_set_header Host $host; with proxy_set_header Host $http_host;