2023-12-13 20:32:50 -05:00
|
|
|
set $test "";
|
2020-02-19 15:55:06 +11:00
|
|
|
if ($scheme = "http") {
|
2023-12-13 20:32:50 -05:00
|
|
|
set $test "H";
|
|
|
|
|
}
|
|
|
|
|
if ($request_uri = /.well-known/acme-challenge/test-challenge) {
|
|
|
|
|
set $test "${test}T";
|
|
|
|
|
}
|
2026-01-31 13:11:47 +00:00
|
|
|
|
|
|
|
|
# Check if the ssl staff has been handled
|
2026-02-01 00:16:17 +08:00
|
|
|
set $test_ssl_handled "";
|
2026-02-10 10:52:32 +00:00
|
|
|
if ($trust_forwarded_proto = "") {
|
|
|
|
|
set $trust_forwarded_proto "F";
|
|
|
|
|
}
|
|
|
|
|
if ($trust_forwarded_proto = "T") {
|
2026-02-01 00:16:17 +08:00
|
|
|
set $test_ssl_handled "${test_ssl_handled}T";
|
2026-01-31 13:11:47 +00:00
|
|
|
}
|
2026-01-28 14:04:32 +10:00
|
|
|
if ($http_x_forwarded_proto = "https") {
|
2026-02-01 00:16:17 +08:00
|
|
|
set $test_ssl_handled "${test_ssl_handled}S";
|
2026-01-31 13:11:47 +00:00
|
|
|
}
|
|
|
|
|
if ($http_x_forwarded_scheme = "https") {
|
2026-02-01 00:16:17 +08:00
|
|
|
set $test_ssl_handled "${test_ssl_handled}S";
|
2026-01-31 13:11:47 +00:00
|
|
|
}
|
2026-02-01 00:16:17 +08:00
|
|
|
if ($test_ssl_handled = "TSS") {
|
|
|
|
|
set $test_ssl_handled "TS";
|
2026-01-31 13:11:47 +00:00
|
|
|
}
|
2026-02-01 00:16:17 +08:00
|
|
|
if ($test_ssl_handled = "TS") {
|
2026-01-28 14:04:32 +10:00
|
|
|
set $test "${test}S";
|
|
|
|
|
}
|
2026-01-31 13:11:47 +00:00
|
|
|
|
2023-12-13 20:32:50 -05:00
|
|
|
if ($test = H) {
|
2020-02-19 15:55:06 +11:00
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
|
}
|