当我在NGINX中添加一个单独的控制-允许-Origin头时,它有两个。当我删除add_header行时,没有。所以IDK是额外的起源被添加的地方。
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name service.alloy.love;
root /var/www/cybers-cafe/cybers-cafe-service/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)
access_log /var/log/nginx/service.alloy.love/access.log;
error_log /var/log/nginx/service.alloy.love/error.log;
ssl_certificate /etc/letsencrypt/live/alloy.love/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/alloy.love/privkey.pem;
include /etc/nginx/snippets/ssl-params.conf;
# location /static/ {
# alias /var/www/cybers-cafe/static/;
# try_files $uri $uri/ =404;
# }
location / {
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://127.0.0.1:59595;
add_header 'Access-Control-Allow-Origin' 'https://www.alloy.love';
}
location ~ /.well-known {
allow all;
}
client_max_body_size 50m;
}
字符串
我试图删除
add_header 'Access-Control-Allow-Origin' 'https://www.alloy.love';
型
但正如我所说,它完全删除了标题。
我试着加上
proxy_hide_header Access-Control-Allow-Origin;
型
但这也完全去除了报头。
1条答案
按热度按时间nfeuvbwi1#
我也遇到了同样的问题,我修复了它,从请求的脚本中删除了
"Access-Control-Allow-Origin"
响应头,并将其仅保留为Nginx指令在我的例子(pythonscript)中,我从
BaseHTTPRequestHandler
类的do_GET
和do_OPTIONS
方法中删除了:字符串