redirect from http to https

Igor Sysoev is at rambler-co.ru
Tue Mar 10 23:21:46 MSK 2009


On Tue, Mar 10, 2009 at 08:51:23PM +0100, Steve Zhuo wrote:

> 42 entries were logged...
> 
> *1 "^/(.*)" matches "/", client: 10.10.10.10, server: www.domain.com, 
> request: "GET / HTTP/1.1", host: "www.domain.com"
> 2009/03/10 15:40:31 [notice] 15197#0: *1 rewritten redirect: 
> "https://www.domain.com/", client: 10.10.10.10, server: www.domain.com, 
> request: "GET / HTTP/1.1", host: "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *4 "^/(.*)" matches "/", client: 
> 127.0.0.1, server: www.domain.com, request: "GET / HTTP/1.0", host: 
> "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *4 rewritten redirect: 
> "https://www.domain.com/", client: 127.0.0.1, server: www.domain.com, 
> request: "GET / HTTP/1.0", host: "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *6 "^/(.*)" matches "/", client: 
> 127.0.0.1, server: www.domain.com, request: "GET / HTTP/1.0", host: 
> "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *6 rewritten redirect: 
> "https://domain.com/", client: 127.0.0.1, server: www.domain.com, 
> request: "GET / HTTP/1.0", host: "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *8 "^/(.*)" matches "/", client: 
> 127.0.0.1, server: www.domain.com, request: "GET / HTTP/1.0", host: 
> "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *8 rewritten redirect: 
> "https://www.domain.com/", client: 127.0.0.1, server: www.domain.com, 
> request: "GET / HTTP/1.0", host: "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *10 "^/(.*)" matches "/", client: 
> 127.0.0.1, server: www.domain.com, request: "GET / HTTP/1.0", host: 
> "www.domain.com"
> 2009/03/10 15:40:32 [notice] 15197#0: *10 rewritten redirect: 
> "https://www.domain.com/", client: 127.0.0.1, server: www.domain.com, 
> request: "GET / HTTP/1.0", host: "www.domain.com"
> 2009/03/10 15:40:33 [notice] 15197#0: *12 "^/(.*)" matches "/", client: 
> 127.0.0.1, server: www.domain.com, request: "GET / HTTP/1.0", host: 
> "www.domain.com"
> 
> .........
> 
> 2009/03/10 15:40:36 [notice] 15197#0: *42 rewritten redirect: 
> "https://www.domain.com/", client: 127.0.0.1, server: www.domain.com, 
> request: "GET / HTTP/1.0", host: "www.domain.com"

As client address is 127.0.0.1, it seems that your HTTPS proxy_pass

 location / {
      proxy_pass  http://mysvr;
   }

proxies just to your first server:

server {
        listen       80;
        server_name  www.domain.com domain.com;
        rewrite     ^(.*)  https://$server_name$1 permanent;
}

and here is a loop.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list