Question
I cannot get CORS working
Let me preface this with the fact it’s my first time setting up anything in a cloud server, and my previous knowledge consists of doing a local WAMP stack and using web hosting solutions.
I’ve set up an Ubuntu LAMP Install fine, and what I can’t get to work is the CORS! I suspect the module headers, because I don’t seem to get any change on my response headers. I’ve enabled the mod:
sudo a2enmod headers
sudo service apache2 restart
I tried the same .htaccess I used before doing the migration, but it didn’t work, thus for testing purposes I’m using only:
Header set Access-Control-Allow-Origin "*"
Then I did a apachectl -t, which gives me Syntax OK. The following is an excerpt of an apachectl -M:
headers_module (shared)
It should be working, but it’s not. What am I doing wrong?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
Additional information: I figured it’s a subdomain related issue. If the file gets served from domain.com/assets/ I get the right response header, if it gets served from assets.domain.com/ it doesn’t.
I’m currently attempting to determine if it has anything to do with my virtual hosts.