我的 nginx 配置中有以下内容:
location / {
# CORS
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST' always;
proxy_pass http://localhost:8080/guacamole/; # systemd: tomcat9
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cookie_path /guacamole/ /;
access_log off;
}
当我向服务器发送POST
请求时,Access-Control-Allow-Origin
响应中不存在标头。但是,当我发送GET
请求时。任何想法为什么?
我似乎代理覆盖
Access-Control-Allow-Origin
了响应中的标头。我通过添加解决了这个问题always
: