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: