Update force-ssl.conf to allow for letsencrypt directories over http

This commit is contained in:
baudneo
2022-10-30 18:59:18 -06:00
parent bf6a32b92e
commit dabeb0907c

View File

@@ -1,3 +1,14 @@
# Since force-ssl.conf has now moved to the server section it overrides the letsencrypt config
# which is inside a location section
# Set FORCE variable in first 2 if tests and action in the third
set $FORCE "";
if ($scheme = "http") { if ($scheme = "http") {
set $FORCE 'H';
}
if ($request_uri !~ "^/.well-known/acme-challenge/(.*)") {
set $FORCE "${FORCE}D";
}
# If we are http and outside the letsencrypt directories redirect via 301
if ($FORCE = HD) {
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }