By majix
I’ve added Header set Access-Control-Allow-Origin "*" in apache httpd.conf but still i get CORS policy error in console.
Apache httpd.conf:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
Console error:
Redirect from ... to ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ... is therefore not allowed access.
And You can see the response headers in this image.
https://i.stack.imgur.com/XM9Rp.png
My website is a multisite Wordpress. I’ve tested different plugins for this purpose and also .htaccess. Everything including ajax requests from subdomains and vice versa were fine but suddenly this error happened without touching a single code on the server. Is there any solution for this error?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Can you move the header directive inside your SSL vhost in httpd.conf (or wherever you have the vhost defined:
<VirtualHost IP_ADDRESS:443>
...<snip>...
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</VirtualHost>
Make sure that all checks out before you restart Apache:
httpd -t || apachectl -t
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.