I recently setup letsencrypt with my site, and the SSL works perfectly. However, when I set Nginx to redirect HTTPS to HTTPS, I get a redirect loop where when you visit the website and refresh the URL changes back and forth from example.com
to https://example.com
.
This is my configuration:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
root /var/www;
index index.html;
# ssl_certificate, etc...
location / {
try_files $uri $uri/ /index.html =404;
}
}
What am I doing incorrectly here that causes the redirect loop?
curl -LI http://example.com/some/path
? (Substitute suitable values forexample.com
and the path)