Welcome! Log In Create A New Profile

Advanced

Re: Redirect http:8080 to https:8443

June 05, 2017 08:44AM
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
Subject Author Posted

Redirect http:8080 to https:8443

ST June 05, 2017 08:30AM

Re: Redirect http:8080 to https:8443

Jim Ohlstein June 05, 2017 08:44AM

Re: Redirect http:8080 to https:8443

mike-pt June 05, 2017 08:50AM

Re: Redirect http:8080 to https:8443

ST June 05, 2017 09:02AM

Re: Redirect http:8080 to https:8443

Anonymous User June 05, 2017 09:18AM

Re: Redirect http:8080 to https:8443

ST June 05, 2017 10:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 100
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready