简体   繁体   English

访问 abcd.com 上的字体已被 CORS 政策阻止:没有“访问控制允许来源”

[英]Access to Font at abcd.com has been blocked by CORS policy: No 'Access-Control-Allow-Origin'

I copy exact wordpress website from one domain to another domain.我将确切的 wordpress 网站从一个域复制到另一个域。 Now the website is running on both domains with same content and images.现在该网站在具有相同内容和图像的两个域上运行。 I stuck in wierd situation from last 24 hours.从过去的 24 小时开始,我陷入了奇怪的境地。 I am not getting the font icons on the website.我没有在网站上获得字体图标。 I am getting cross origin error in the console.我在控制台中收到交叉原点错误。 I try as many as possible things to make it fix我尝试尽可能多的事情来修复它

1. I try to add fonts differently in the header. 1.我尝试在标题中添加不同的字体。 But Not working但不工作

2. I try to allow it in header of php file 2.我尝试在php文件的标题中允许它

header('content-type: application/json; charset=utf-8');
header("access-control-allow-origin: http://www.abcdef.com/");
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');

3. I try to use wordpress cros plugin (which is outdated and not tested) 3.我尝试使用wordpress cros插件(已过时且未经测试)

4 I tried to clear the wordpress cache. 4我试图清除wordpress缓存。 Even I try to upload the website again.甚至我尝试再次上传网站。

But Nothing works.但没有任何作用。 All this I try from the stackoverflow solutions.所有这些都是我从 stackoverflow 解决方案中尝试的。

Now Please help me regarding this现在请帮我解决这个问题

Thank you谢谢

Don't have absolute links to resources (ie ones that have the domain in them too), use ones like '/[font-name]' instead.不要有资源的绝对链接(即那些也有域的资源),而是使用像“/[font-name]”这样的链接。 That way it will use the same domain and protocol that the page requesting it is.这样,它将使用与请求它的页面相同的域和协议。

Also take a look at this existing question:也看看这个现有的问题:

CORS with php (Wordpress) 带有 php (Wordpress) 的 CORS

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 已被 CORS 政策阻止:无“访问控制允许来源” - has been blocked by CORS policy: No 'Access-Control-Allow-Origin' PHP-CORS策略已阻止对字体的访问:没有“ Access-Control-Allow-Origin”标头 - PHP - Access to Font has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header 无法在React中使用GraphQL查询-已被CORS策略阻止:所请求的资源上不存在“ Access-Control-Allow-Origin”标头 - Cannot use GraphQL queries in React - has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource 被 CORS 策略阻止:“Access-Control-Allow-Origin”header 包含多个值 - Blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values Laravel7 CORS:被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:否 'Access-Control-Allow-Origin' - Laravel7 CORS : blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' Cors header “访问控制允许来源”被阻止 Api 响应 - Cors header “Access-control-allow-origin” blocked Api Response Laravel 从源访问 XMLHttpRequest 已被 CORS 策略阻止 - Laravel Access to XMLHttpRequest at from origin has been blocked by CORS policy Laravel 上的 CORS (Access-Control-Allow-Origin) - CORS (Access-Control-Allow-Origin) on Laravel Laravel Cors Access-Control-Allow-Origin - Laravel Cors Access-Control-Allow-Origin Google字体:无访问权限-允许来源:* - Google Font: no Access-Control-Allow-Origin:*
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM