I have the following in my nginx config:
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;
}
When I send a POST
request to the server, the Access-Control-Allow-Origin
header is not present in the response. It is, however, when I send a GET
request. Any ideas why?
I seems that the proxy was overriding the
Access-Control-Allow-Origin
header in the response. I fixed this by addingalways
: