https redirect going to infinite loop

Francis Daly francis at daoine.org
Fri Jul 12 08:10:53 UTC 2013


On Fri, Jul 12, 2013 at 02:50:56AM -0400, parulsood85 wrote:

Hi there,

>    server {
>         listen       80;
>         server_name  example.com;

So: nginx is not listening for https requests?

>         location / {
>                         rewrite ^(.*)  https://example.com permanent;
>                         proxy_pass  http://my-backend;

Aside: It is unlikely that both of these lines do something useful.

> the output of curl -i http://example.com
> 
> curl: (7) couldn't connect to host 

And the http server isn't listening at all? Or maybe your routing or
other proxying is broken -- this command should be run from the same
machine that a browser is on that sees the failure. The aim is to see
the exact response which leads to the failure. But it may not matter,
see below.

> The loadbalancer is in the different DMZ it will sent the request on port 80
> & 443 to nginx server on port 80.

So: the loadbalancer listens for http and https, and sends both requests
to nginx as http?

Which means nginx can't tell whether the initial request was http or https?

Do the http-to-https redirect on the load balancer, which knows whether
the initial request was http or https.

Or configure the load balancer to give a clue to nginx whether the
initial request was http or https, and configure your nginx to respond
to that clue.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list