Welcome! Log In Create A New Profile

Advanced

Re: Forcing SSL;

António P. P. Almeida
February 08, 2011 11:46AM
On 8 Fev 2011 16h14 WET, david@styleflare.com wrote:

> Wouldn't that create an infinite loop?

No because they're listening on different ports. No need for an
if. Use two server blocks as suggested.

The server block for port 80 always does a permanent redirect do the
the same server but listening on 443 with a SSL socket.

All the page processing happens at the server block for port 443.

server {
## This is to avoid the spurious if for sub-domain name
## rewriting. See http://wiki.nginx.org/Pitfalls#Server_Name.
listen [::]:80;
server_name example.com;
rewrite ^ https://example.com$request_uri? permanent;
} # server domain rewrite.

server {
listen [::]:443 ssl;
server_name example.com;
(...)
}
--- appa




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

Forcing SSL;

David J. February 08, 2011 11:06AM

Re: Forcing SSL;

Luit van Drongelen February 08, 2011 11:10AM

Re: Forcing SSL;

David J. February 08, 2011 11:16AM

Re: Forcing SSL;

Luit van Drongelen February 08, 2011 11:36AM

Re: Forcing SSL;

David J. February 08, 2011 11:44AM

Re: Forcing SSL;

António P. P. Almeida February 08, 2011 11:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
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