fix: preserve public HTTPS checkout links

This commit is contained in:
jwinterm
2026-07-16 08:50:07 -04:00
parent f84d8c7d98
commit 531038fd1a
+11 -3
View File
@@ -8,6 +8,14 @@ limit_req_zone $binary_remote_addr zone=global_rate_limit:10m rate=50r/s;
# restarted. `valid=10s` bounds the stale window to ~10 seconds. # restarted. `valid=10s` bounds the stale window to ~10 seconds.
resolver 127.0.0.11 valid=10s ipv6=off; resolver 127.0.0.11 valid=10s ipv6=off;
# Preserve a trusted outer proxy's HTTPS scheme without reflecting arbitrary
# client-supplied values into invoice and checkout URLs.
map $http_x_forwarded_proto $origin_scheme {
default $scheme;
http http;
https https;
}
server { server {
listen 80; listen 80;
server_name wowcheckout.such.software localhost; server_name wowcheckout.such.software localhost;
@@ -25,7 +33,7 @@ server {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $origin_scheme;
} }
location /api { location /api {
@@ -38,7 +46,7 @@ server {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $origin_scheme;
} }
location /qr/ { location /qr/ {
@@ -53,6 +61,6 @@ server {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $origin_scheme;
} }
} }