Fix HTTPS redirects when a non-default HTTPS port is used.