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

Since we have moved force-ssl.conf into the server section, it overrides the location based letsencrypt allowed over http

- Make force-ssl only work if both http traffic and outside the letsencrypt directories.
This commit is contained in:
Paul Mansfield 2022-05-04 17:03:38 +01:00 committed by GitHub
parent 4db34f5894
commit 12b0fb47fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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") {
return 301 https://$host$request_uri;
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;
}