<input type="hidden" id="_wpnonce" name="_wpnonce" value="02b257dc98" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/5064" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="02b257dc98" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/5064" />{"id":5064,"date":"2016-05-12T01:50:38","date_gmt":"2016-05-11T15:50:38","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=5064"},"modified":"2016-05-11T19:01:50","modified_gmt":"2016-05-11T09:01:50","slug":"resolving-issue-with-cross-origin-resource-sharing-policy-websites","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2016\/05\/12\/resolving-issue-with-cross-origin-resource-sharing-policy-websites\/","title":{"rendered":"RESOLVING ISSUE WITH CROSS ORIGIN RESOURCE SHARING POLICY FOR WEBSITES"},"content":{"rendered":"<!--CusAds0--><p>Another issue that we experienced was displaying content from different domains especially when using HTTP and HTTPS. Here&#8217;s an example of the error message:<\/p>\n<p>Font from origin &#8216;https:\/\/website&#8217; has been blocked from loading by Cross-Origin Resource Sharing policy: No &#8216;Access-Control-Allow-Origin&#8217; header is present on the requested resource. Origin &#8216;http:\/\/website&#8217; is therefore not allowed access.<\/p>\n<p>The fix is to add the following statement to either the .htaccess file or if you&#8217;re using nginx VPS then add it to the nginx.conf file in \/etc\/nginx\/<\/p>\n<p><em>add_header &#8216;Access-Control-Allow-Origin&#8217; &#8216;*&#8217;;<\/em><\/p>\n<div id=\"attachment_5071\" style=\"width: 646px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all&w=2560\"><img decoding=\"async\" aria-describedby=\"caption-attachment-5071\" class=\"size-full wp-image-5071\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all\" alt=\"resolving issue with cross origin resource sharing policy for websites\" width=\"636\" height=\"344\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all 636w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-300x162.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-178x96.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all&amp;w=127 127w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all&amp;w=381 381w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all&amp;w=508 508w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites.png?strip=all&amp;w=450 450w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><p id=\"caption-attachment-5071\" class=\"wp-caption-text\">resolving issue with cross origin resource sharing policy for websites<\/p><\/div>\n<p>Once you&#8217;ve added it to the nginx.conf file make sure to restart the service by using the command:<\/p><!--CusAds0-->\n<p>service nginx restart<\/p>\n<p>Then you can test it by using <em>curl -I http:\/\/website<\/em><\/p>\n<p><a href=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all&w=2560\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5072\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all\" alt=\"resolving issue with cross origin resource sharing policy for websites curl\" width=\"633\" height=\"274\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all 633w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl-300x130.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl-178x77.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all&amp;w=126 126w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all&amp;w=379 379w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all&amp;w=506 506w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/05\/resolving-issue-with-cross-origin-resource-sharing-policy-for-websites-curl.png?strip=all&amp;w=450 450w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><\/a><\/p>\n<p>If the curl result has Access-Control-Allow-Origin: * then it means the nginx changes worked.<\/p>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">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!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Another issue that we experienced was displaying content from different domains especially when using HTTP and HTTPS. Here&#8217;s an example of the error message: Font from origin &#8216;https:\/\/website&#8217; has been blocked from loading by Cross-Origin Resource Sharing policy: No &#8216;Access-Control-Allow-Origin&#8217; header is present on the requested resource. Origin &#8216;http:\/\/website&#8217; is therefore not allowed access. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5076,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2046,1043],"tags":[609,2364,2366,502,2367,1989,2365,94],"class_list":["post-5064","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-website","category-websites","tag-access","tag-cross","tag-curl","tag-domain","tag-htaccess","tag-nginx","tag-origin","tag-website"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=5064"}],"version-history":[{"count":5,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5064\/revisions"}],"predecessor-version":[{"id":5073,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5064\/revisions\/5073"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/5076"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=5064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=5064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=5064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}