Skip to content

Commit 013310d

Browse files
committed
LetsEncrypt ACME redirect issue fixes NginxProxyManager#2881
1 parent fa851b6 commit 013310d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Since force-ssl.conf has now moved to the server section it overrides
2+
# the LetsEncrypt config which is inside a location section
3+
# Set FORCE variable in first two if tests pass and action in the third
4+
set $FORCE "";
15
if ($scheme = "http") {
2-
return 301 https://$host$request_uri;
6+
set $FORCE 'H';
37
}
8+
if ($request_uri !~ "^\/.well-known\/acme-challenge\/(.*)") {
9+
set $FORCE "${FORCE}D";
10+
}
11+
# If we are http and outside the LetsEncrypt directories redirect to https via 301
12+
if ($FORCE = HD) {
13+
return 301 https://$host$request_uri;
14+
}

0 commit comments

Comments
 (0)