Redirect problem

I’ve a problem with a redirect http https and using non-www

Can you tell me what is wrong? sometimes i have redirect loop.

server {
listen 80;
listen [::1]:80;
server_name domain.com;
return 301 https://www.domain.com$request_uri;
}

server {
listen 80;
listen [::1]:80;
server_name www.domain.com;
return 301 https://www.domain.com$request_uri;
}

server {
listen 443 ssl spdy;
listen [::1]:443 ssl spdy;
server_name www.domain.com;

}

Thanks.

Posted at Nginx Forum:

On Sat, Jan 24, 2015 at 12:07:22AM -0500, Kurogane wrote:

Hi there,

Can you tell me what is wrong? sometimes i have redirect loop.

The config you show looks ok to me.

What do the logs say, when you have a redirect loop?

Does something in your https site redirect back to http?

f

Francis D. [email protected]