Welcome! Log In Create A New Profile

Advanced

Re: http -> https redirection, with a twist?

Brad Knowles
February 28, 2012 10:46PM
On Feb 28, 2012, at 9:42 PM, António P. P. Almeida wrote:

> Then just define two server blocks. One redirects to 443 and the other
> to 8443.

I didn't realize that you could have multiple server blocks that were listening to the same port. That was the piece I was missing!

> Alternatively you could use map and a single server block. At the http
> level.
>
> map $host $redirect_port {
> hostnames;
> default 443;
> f.domain.com 8443; # this is the domain that redirects to 8443
> }
>
> server {
> server_name a.domain.com c.domain.com d.domain.com f.domain.com; # list all domains
> listen 80;
> return 301 https://$host:$redirect_port$request_uri;
> }

Ahh, that's very cool, too. Now I have two solutions for just the one problem.

Thanks!

--
Brad Knowles <brad@shub-internet.org>
LinkedIn Profile: http://tinyurl.com/y8kpxu

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

http -> https redirection, with a twist?

Brad Knowles February 28, 2012 09:08PM

Re: http -> https redirection, with a twist?

António P. P. Almeida February 28, 2012 09:22PM

Re: http -> https redirection, with a twist?

Brad Knowles February 28, 2012 10:28PM

Re: http -> https redirection, with a twist?

António P. P. Almeida February 28, 2012 10:44PM

Re: http -> https redirection, with a twist?

Brad Knowles February 28, 2012 10:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready