fix: nginx配置问题处理
This commit is contained in:
1 parent
df34fc30cc
commit
fa0dc7e7e1
4 files changed
+42
-8
No files matched your search
+11
-1
@@ -41,7 +41,7 @@ server {
|
||||
|
||||
# API proxy to backend (if backend is on the same server)
|
||||
location /api/ {
|
||||
proxy_pass http://host.docker.internal:18888/;
|
||||
proxy_pass http://host.docker.internal:18888/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -49,6 +49,16 @@ server {
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
# 添加 CORS 头支持
|
||||
proxy_pass_header Access-Control-Allow-Origin;
|
||||
proxy_pass_header Access-Control-Allow-Methods;
|
||||
proxy_pass_header Access-Control-Allow-Headers;
|
||||
proxy_pass_header Access-Control-Allow-Credentials;
|
||||
|
||||
# 添加日志用于调试
|
||||
access_log /var/log/nginx/api_proxy.log;
|
||||
error_log /var/log/nginx/api_proxy_error.log;
|
||||
}
|
||||
|
||||
# Disable access to hidden files
|
||||
|
||||
Reference in new issue
Block a user