On Mon, 2017-06-05 at 15:28 +0300, ST wrote:
> Hello,
> 
> I try to redirect http on port 8080 to https on port 8443 as follows,
> but it doesn't seem to work. http redirects to https, but the port
> remains the same - 8080. Why?
> 
> Thank you!
> 
> # redirect http to https
> server {
>     listen 8080;
>     server_name n.example.com;
>     return 301 https://$host:8443/$request_uri;
> }
> 
> server {
>         listen   8443 ssl;
>       server_name n.example.com;
> ...
> }

This is _just a guess_, but "$host" may contain the port.

Try using:

        return 301 https://n.example.com:8443$request_uri;

-- 
Jim Ohlstein
Professional Mailman Hosting
https://mailman-hosting.com/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to