as described above I have the following nginx header-config:
# Add CORS headers
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'I-Am-a-test-header' 'hiii' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Content-Length' '0' always;
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Hi-am-prerequest' 'hooo' always;
return 204;
}
but the Access-Control-Allow-Origin header will not be added, everything else is.
result headers
I tried it already with string and everything else instead of “$http_origin” but same result…
How can that be, and what can I do to get this header added?
thank you very much.
I tried to set the Access-Control-Allow-Origin as decribed in many different solution to solve my client cors problem, but the header just will not appear. I do not have access to the backend server.
littlehope is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.