I was wondering if anybody can help me set up CORS on my Apache web server. I would appreciate a step-by-step process because many sites online are telling me different things. Like what do I need to do on my httpd.conf
or ssl.conf
files, where to put my .htaccess
file, etc.
The above answer is correct and put Inside the httpd.conf
. This should be changed to whatever you set Document Root.
On Ubuntu, httpd.conf
is located in the directory /etc/apache2. apache2.conf
is also located in /etc/apache2.
On CENTOS 6 httpd.conf
in the path /etc/httpd/conf/httpd.
<Directory "/var/www/html">
Header set Access-Control-Allow-Origin "*"
</Directory>
# edit your conf/httpd.conf file. Verify that the headers module is loaded
LoadModule headers_module modules/mod_headers.so
# to whitelist every origin, use
Header set Access-Control-Allow-Origin "*"
More info: http://enable-cors.org/server_apache.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With