My Nginx config is set to redirect non www and also non https to
https://www.topweb.wales
This means I have 3 server blocks:
server_name topweb.wales
www.topweb.wales; for port 80 There is no https so
return 301 https://www.topweb.wales:443$request_uri; send to
https://www
server_name topweb.wales; for port 443 ssl There is no www so
return 301 https://www.topweb.wales$request_uri; send to
https://www
Now we are where we should be so:
server_name
www.topweb.wales; This is correct.
If I make any change by editing the www-domain for instance enabling gzip or altering the cache then all 3 server blocks have their name changed like:
server_name
www.topweb.wales topweb.wales;
This causes an infinite redirect loop.
Why are the server blocks re-written each time? just to add entries.