fix: 微信 JS 安全域名校验文件去掉多余换行
Some checks failed
Build and Deploy Front / deploy (push) Has been cancelled

确保 MP_verify 与公众平台下载包字节一致,并禁止 SPA 回落与 Git CRLF 改写。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-09-08 18:22:47 +08:00
parent 08cb7bcb37
commit 8c897739a6
4 changed files with 18 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# 微信域名校验文件必须与公众平台下载包字节完全一致(禁止 CRLF / 尾换行)
public/MP_verify_*.txt binary

View File

@ -420,6 +420,14 @@ server {
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)$ {

View File

@ -160,6 +160,14 @@ server {
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;