• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Unable to change CORS header

JDev17

New Pleskian
Hi

Setting the CORS header is a major headache. Most of the time, nothing happens, two headers will be applied or the wrong header will be applied.

I have set a CORS header for nginx (example.com and example2.com for privacy reasons):

add_header 'Access-Control-Allow-Origin' 'https://example.com';

Then I moved / renamed my domain from example.com to example2.com and had to change the header again:

add_header 'Access-Control-Allow-Origin' 'https://example2.com';

After changing the header, nothing changed at all.
I get an error that the header is set to example.com but my domain is example2.com.

I have struggled a lot getting CORS to work before. Even setting the example.com header took me like 1h with server reboots, setting the header and removing it, setting apache headers and removing them, restarting the nginx service and much more until it suddenly worked.

I don't know if this is relevant but I am setting the header for a subdomain of example.com / example2.com

Any Idea what's causing this or am I doing something wrong?
 
Nevermind, I had set a header in my nodejs app which was passed on and I forgot to change it. I didn't know headers from a nodejs app will be passed on.
 
Back
Top