Welcome! Log In Create A New Profile

Advanced

Re: How to redirect all SSL traffic?

November 09, 2009 03:00AM
On Sun, Nov 08, 2009 at 05:23:02PM -0700, Alex Hunsaker wrote:

> On Sun, Nov 8, 2009 at 15:25, Glen Lumanau <glen@lumanau.web.id> wrote:
> > Ok ill try that.
> >
> > Why we can't use the same method for port 443?
>
> I assumed www.mydomain.com and mydomain.com have the same ip address
> and hence will go to the same nginx instance. SSL only works with one
> ip (unless you are using TLS with the server name stuff) so the server
> { listen 443; } gets traffic for both www.mydomain.com and
> mydomain.com. But it needs to redirect when it does not have the www
> to www.mydomain.com and also serve the real www.mydomain.com page when
> you go to www.mydomain.com. Hence the difference.
>
> Im sure there are other ways to do it, experiment a bit :)

Anyway,

server {
listen 443;
server_name mydomain.com;
}

server {
listen 443;
server_name www.mydomain.com;
}

should work as well as

if ($host !~ www\.mydomain\.com) {

however, using "if" is uneffective way.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

How to redirect all SSL traffic?

Glen Lumanau November 07, 2009 10:42PM

Re: How to redirect all SSL traffic?

Alex Hunsaker November 07, 2009 10:50PM

Re: How to redirect all SSL traffic?

Alex Hunsaker November 08, 2009 05:16PM

RE: How to redirect all SSL traffic?

Glen Lumanau November 08, 2009 08:54PM

Re: How to redirect all SSL traffic?

Igor Sysoev November 09, 2009 03:00AM

Re: How to redirect all SSL traffic?

Glen Lumanau November 09, 2009 03:20AM

Re: How to redirect all SSL traffic?

edogawaconan November 09, 2009 03:58AM

Re: How to redirect all SSL traffic?

Maxim Dounin November 09, 2009 05:24AM

Re: How to redirect all SSL traffic?

Glen Lumanau November 09, 2009 05:30AM

Re: How to redirect all SSL traffic?

Igor Sysoev November 09, 2009 05:32AM

RE: How to redirect all SSL traffic?

Glen Lumanau November 09, 2009 05:38AM

Re: How to redirect all SSL traffic?

Igor Sysoev November 09, 2009 05:46AM

Re: How to redirect all SSL traffic?

brianmercer November 11, 2009 09:27AM

Re: How to redirect all SSL traffic?

Igor Sysoev November 11, 2009 10:04AM

Re: How to redirect all SSL traffic?

Gena Makhomed November 11, 2009 10:04AM

Re: How to redirect all SSL traffic?

Glen Lumanau November 08, 2009 05:32PM

Re: How to redirect all SSL traffic?

Alex Hunsaker November 08, 2009 07:30PM

Re: How to redirect all SSL traffic?

Igor Sysoev November 09, 2009 03:00AM

Re: How to redirect all SSL traffic?

Ken Peterson December 29, 2010 01:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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