Can someone explain why Certbot is using the following redirect configuration
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name example.com;
listen 80;
return 404; # managed by Certbot
}
instead of simply this one?
server {
server_name example.com;
listen 80;
return 301 https://$host$request_uri;
}
server_name
basically says that this config only applies to example.com, so $host
can never be anything different, or am I missing something?