fix(nginx): 正確轉發 X-Forwarded-Proto 標頭 (解決 Mixed Content 根源問題)
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Successful in 45s

This commit is contained in:
2026-02-02 14:57:18 +08:00
parent 8a34aae312
commit b0192e9b66

View File

@@ -1,5 +1,12 @@
# 正式環境 (Production) - 端口 80 # 正式環境 (Production) - 端口 80
# 外部 SSL 終止後(如 Cloudflare/NPM轉發至此端口 # 外部 SSL 終止後(如 Cloudflare/NPM轉發至此端口
# 定義 map 以正確處理 X-Forwarded-Proto
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
server { server {
listen 80; listen 80;
server_name erp.koori.tw erp.mamaiclub.com; server_name erp.koori.tw erp.mamaiclub.com;
@@ -9,7 +16,7 @@ server {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
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 $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Host $host;
} }
} }