• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Question Enable CORS for dockerized node.js api

Balduraan

New Pleskian
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: 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:
Back
Top