ff
This commit is contained in:
@@ -13,9 +13,18 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 前端路由
|
||||
# 重要:确保所有路由都指向 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# 添加必要的跨域和缓存控制头
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Cache-Control no-cache;
|
||||
|
||||
# 添加安全相关头
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
}
|
||||
|
||||
# API-UAA 服务代理
|
||||
@@ -25,11 +34,12 @@ server {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# 添加跨域头
|
||||
# 添加跨域支持
|
||||
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';
|
||||
|
||||
add_header Access-Control-Allow-Headers '*';
|
||||
add_header Access-Control-Expose-Headers '*';
|
||||
|
||||
# 处理 OPTIONS 请求
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
|
||||
Reference in New Issue
Block a user