front/nginx-k3s.conf
zzh 8c897739a6
Some checks failed
Build and Deploy Front / deploy (push) Has been cancelled
fix: 微信 JS 安全域名校验文件去掉多余换行
确保 MP_verify 与公众平台下载包字节一致,并禁止 SPA 回落与 Git CRLF 改写。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:22:47 +08:00

183 lines
7.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# k3s 方案 A:仅静态 SPA。API 由浏览器直连 api.ideship.com(本文件不做反代)。
server {
listen 80;
server_name _;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml image/svg+xml;
root /usr/share/nginx/html;
location = / {
# 官网优先;缺失时回退 SPA,避免 readiness 探针 404
try_files /site/index.html /index.html =404;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
location = /9610.html {
try_files /9610.html =404;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
location = /site {
return 301 /;
}
location = /site/ {
return 301 /;
}
location = /site/index.html {
return 301 /;
}
location ^~ /site/ {
try_files $uri =404;
expires 7d;
add_header Cache-Control "public";
access_log off;
}
location = /favicon.ico {
try_files /favicon.png =404;
expires 7d;
add_header Cache-Control "public";
access_log off;
}
location = /favicon.png {
try_files /favicon.png =404;
expires 7d;
add_header Cache-Control "public";
access_log off;
}
location = /login {
try_files /index.html =200;
}
location = /login/ {
try_files /index.html =200;
}
rewrite ^/admin/?$ /index.html last;
location = /admin {
try_files /index.html =200;
}
location = /admin/ {
try_files /index.html =200;
}
location ~ ^/api/(upstreamInterface|upstreamInterfaceConfig|upstreamInterfaceConfigEdit|downstreamInterface(|/newPort)|appList(|/createApplication)|requestLog|callStatistics|apiDebugger|apiTest)(/|$) {
try_files /index.html =200;
}
location ^~ /xhs/startService { try_files /index.html =200; }
location ^~ /xhs/creation { try_files /index.html =200; }
location ^~ /xhs/publishHistory { try_files /index.html =200; }
location ^~ /xhs/skills { try_files /index.html =200; }
location ^~ /xhs/humanSettings { try_files /index.html =200; }
location ^~ /xhs/agentPair { try_files /index.html =200; }
location = /xhs/analysis { try_files /index.html =200; }
location = /xhs/analysis/ { try_files /index.html =200; }
location ^~ /wechat/register { try_files /index.html =200; }
location ^~ /wechat/bind { try_files /index.html =200; }
location ^~ /h5 { try_files /index.html =200; }
location ^~ /track/query { try_files /index.html =200; }
location ^~ /operation/inboundScan { try_files /index.html =200; }
location ^~ /operation/outboundScan { try_files /index.html =200; }
location ^~ /operation/printLabel { try_files /index.html =200; }
location ^~ /operation/parcelArrival { try_files /index.html =200; }
location ^~ /operation/fulfillPack { try_files /index.html =200; }
# 订单前端路由(^~ 须比下方 /order/ API 正则代理更优先)
location ^~ /order/priceCheck { try_files /index.html =200; }
location ^~ /order/placeOrder { try_files /index.html =200; }
location ^~ /order/myOrders { try_files /index.html =200; }
location ^~ /order/fulfillOrders { try_files /index.html =200; }
location ^~ /order/waybillManage { try_files /index.html =200; }
location ^~ /order/pickupOrder { try_files /index.html =200; }
location ^~ /order/customs9610Order { try_files /index.html =200; }
location ^~ /order/batchJobs { try_files /index.html =200; }
location ^~ /order/templateMapping { try_files /index.html =200; }
location ^~ /order/platformStore { try_files /index.html =200; }
location ^~ /order/platformStoreOrder { try_files /index.html =200; }
# 知识库前端路由(^~ 须比下方 /kb/ API 代理更优先)
location ^~ /kb/category { try_files /index.html =200; }
location ^~ /kb/article { try_files /index.html =200; }
location = /warehouse/parcel { try_files /index.html =200; }
location = /warehouse/inventory { try_files /index.html =200; }
location = /warehouse/sku { try_files /index.html =200; }
location = /warehouse/binLocation { try_files /index.html =200; }
location ^~ /warehouse/inboundNotice { try_files /index.html =200; }
location ^~ /Plugin/ { try_files /index.html =200; }
location ^~ /channel/salesProducts { try_files /index.html =200; }
location ^~ /channel/serviceChannels { try_files /index.html =200; }
location ^~ /channel/priceArea { try_files /index.html =200; }
location ^~ /channel/blacklist { try_files /index.html =200; }
location ^~ /channel/remoteZones { try_files /index.html =200; }
location ^~ /channel/weightRules { try_files /index.html =200; }
location ^~ /channel/weightRounding { try_files /index.html =200; }
location ^~ /channel/autoTrigger { try_files /index.html =200; }
location ^~ /channel/issueTemplate { try_files /index.html =200; }
location ^~ /channel/labelDesign { try_files /index.html =200; }
# 营销前端路由(^~ 须比下方 /marketing/ API 正则代理更优先)
location ^~ /marketing/memberLevel { try_files /index.html =200; }
location ^~ /marketing/pointsRule { try_files /index.html =200; }
location ^~ /marketing/pointsFlow { try_files /index.html =200; }
location ^~ /marketing/couponTemplate { try_files /index.html =200; }
location ^~ /marketing/couponGrant { try_files /index.html =200; }
location ^~ /marketing/commissionRule { try_files /index.html =200; }
location ^~ /marketing/commissionDetail { try_files /index.html =200; }
location ^~ /marketing/commissionWithdraw { try_files /index.html =200; }
location ^~ /marketing/referralTree { try_files /index.html =200; }
# 系统管理前端路由(^~ 须比下方 /system/ API 正则代理更优先)
location = /system/dict { try_files /index.html =200; }
location = /system/warehouseAddress { try_files /index.html =200; }
location = /system/announcement { try_files /index.html =200; }
location ^~ /system/users { try_files /index.html =200; }
location ^~ /system/roles { try_files /index.html =200; }
location ^~ /system/menus { try_files /index.html =200; }
location ^~ /system/organizations { try_files /index.html =200; }
location ^~ /system/batchEmail { try_files /index.html =200; }
location ^~ /system/otherConfig { try_files /index.html =200; }
location ^~ /system/aiAssistant { try_files /index.html =200; }
location ^~ /system/aiSkills { try_files /index.html =200; }
location ^~ /system/mcpTools { try_files /index.html =200; }
location ^~ /system/dataPerm/ { try_files /index.html =200; }
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
# 微信 JS 安全域名校验:原样返回 txt,禁止 SPA 回落 index.html
location ~* ^/MP_verify_[A-Za-z0-9]+\.txt$ {
default_type text/plain;
charset off;
add_header Cache-Control "no-store";
try_files $uri =404;
}
location ~* \.(?:js|css)$ {
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
location / {
index index.html;
try_files $uri /index.html;
}
}