fix(小程序通知):小程序通知使用同一个模板进行消息发送

This commit is contained in:
2025-05-12 10:15:53 +08:00
parent 5789b9bacd
commit 8fc80be482
6 changed files with 91 additions and 69 deletions
+28 -1
View File
@@ -19,7 +19,10 @@ server {
# 添加必要的跨域和缓存控制头
add_header Access-Control-Allow-Origin *;
add_header Cache-Control "no-cache, no-store, must-revalidate";
# 调整缓存策略,例如对于静态资源可以缓存
location ~* \.(css|js|svg|png|jpg|jpeg)$ {
expires 365d;
}
# 添加安全相关头
add_header X-Frame-Options SAMEORIGIN;
@@ -37,6 +40,14 @@ server {
# 确保 Authorization 头可以传递
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
# 处理 OPTIONS 请求
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
return 204;
}
}
# 用户服务代理
@@ -49,6 +60,14 @@ server {
# 确保 Authorization 头可以传递
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
# 处理 OPTIONS 请求
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
return 204;
}
}
# 其他 API 服务代理(如果需要)
@@ -75,5 +94,13 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 处理 OPTIONS 请求
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
return 204;
}
}
}