Hello there!
I have an ubuntu server with plesk obsidian 18.x running.
I have an dockerized node.js graphql api up and running. The api request are comming from an angular pwa and
I get an error that access was blocked due to cors policy.
I enabled CORS inside node.js of course, but I have no clue how to allow / configure CORS in plesk for a docker container.
Plesk is proxying requests from api.domain.com to the said container.
I hope someone can help me solving this problem. This is killing my development progress.
Edit: In plesk under "Settings for Apache & Nginx for api.domain.com" I added additional nginx-instructions:
And the error message changes to:
I have an ubuntu server with plesk obsidian 18.x running.
I have an dockerized node.js graphql api up and running. The api request are comming from an angular pwa and
I get an error that access was blocked due to cors policy.
I enabled CORS inside node.js of course, but I have no clue how to allow / configure CORS in plesk for a docker container.
Plesk is proxying requests from api.domain.com to the said container.
I hope someone can help me solving this problem. This is killing my development progress.
Edit: In plesk under "Settings for Apache & Nginx for api.domain.com" I added additional nginx-instructions:
add_header 'Access-Control-Allow-Origin' '*';
And the error message changes to:
Code:
Access to fetch at 'https://api.domain.com/graphql' from origin 'https://app.domain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Last edited: