Cross Origin Request Error

When receiving a cross-origin / cross original request, CORS header 'Access-Control-Allow-Origin' does not match, or same origin disallow policy error you may need to add an http header to allow the request. The following two examples work in cases regarding Apache and may be used by adding one set to the .htaccess file:

 

<FilesMatch ".(js|css|xml|gz|html|eot|ttd|otf|woff)$">
Header add Access-Control-Allow-Origin "*"
</FilesMatch>

 

<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin "*"
</IfModule>
  • 125 Users Found This Useful

Was this answer helpful?

Related Articles

.html or .htm parsed as .shtml not working

To parse .html or .htm files as .shtml add the following to your .htaccess file in the...

Unable to view Ultrawebhosting.com from my foreign browser.

We are an American company based out of Seattle, WA. Our website is written in English as a...

.htaccess - Allow Let's Encrypt to Validate and Renew

When receiving the following Let's Encrypt error message:domain.com: The SSL certificate expires...

View your website in older browser versions.

As developers and webmasters it is always important to make sure your website works in several...

Enable AllowOverride

If you have an application that requires allowoverride enabled, create an .htaccess file and...