RESOLVING ISSUE WITH CROSS ORIGIN RESOURCE SHARING POLICY FOR WEBSITES

May 12, 2016   /   by Marco  / Categories :  Technology, website, Websites
RESOLVING ISSUE WITH CROSS ORIGIN RESOURCE SHARING POLICY FOR WEBSITES HEADER

Another issue that we experienced was displaying content from different domains especially when using HTTP and HTTPS. Here’s an example of the error message:

Font from origin ‘https://website’ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://website’ is therefore not allowed access.

The fix is to add the following statement to either the .htaccess file or if you’re using nginx VPS then add it to the nginx.conf file in /etc/nginx/

add_header ‘Access-Control-Allow-Origin’ ‘*’;

resolving issue with cross origin resource sharing policy for websites

resolving issue with cross origin resource sharing policy for websites

Once you’ve added it to the nginx.conf file make sure to restart the service by using the command:

service nginx restart

Then you can test it by using curl -I http://website

resolving issue with cross origin resource sharing policy for websites curl

If the curl result has Access-Control-Allow-Origin: * then it means the nginx changes worked.

DO YOU LIKE WHAT YOU'VE READ?
Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!

Our Sponsors

  • Follow us:

OTHER ARTICLES YOU MAY LIKE


USING WP MAIL SMTP TO RECEIVE EMAIL LOGS

USING WP MAIL SMTP TO RECEIVE EMAIL LOGS

Remember the good old days when you could just go to a website and see what all your email addresses were? Those days are gone, unfortunately. One of the biggest problems for businesses and individuals is spam. Spammers send out millions of emails a day, hoping to catch people who are not expecting to receive […]

read more
HIDE THE WEATHER AND NEWS WIDGET IN THE WINDOWS 10 TASKBAR

HIDE THE WEATHER AND NEWS WIDGET IN THE WINDOWS 10 TASKBAR

You may have seen the Weather and News widget appear on your Windows 10 taskbar after a recent update and today, I’m going to show you how to hide the Weather and News Widget. The Windows 10 taskbar is the central component of the Windows operating system that shows all the open programs and their […]

read more

Subscribe

Receive the latest news and awesome deals via email

Like our Page

site auditing tools