WordPress网站原点已被CORS政策阻止:在将网站迁移到SSL(https)证书后没有'access-control-allow-origin' [英] Wordpress site origin has been blocked by CORS policy: no 'access-control-allow-origin' after migrating site to SSL (https) certificate

查看:309
本文介绍了WordPress网站原点已被CORS政策阻止:在将网站迁移到SSL(https)证书后没有'access-control-allow-origin'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将一个WordPress网站从HTTP迁移到了HTTPS,因为内容因CORS策略而被阻止,所以很少有网页无法正常迁移。问题是两个限定CORS策略错误的来源是来自同一个域,但只是它的安全级别不同,一个是HTTPS,另一个是HTTP。



I have just migrated a WordPress website from HTTP to HTTPS and few pages are not migrated properly because the content is blocked due to CORS policy. the problem is two sources to qualify CORS policy error are from the same domain but just its different in security level one is HTTPS and another is HTTP.

Access to Font at 'https://kitabee.in/wp-content/themes/academia/dist/fonts/montserrat/montserrat-regular-webfont.woff2' from origin 'http://kitabee.in' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://kitabee.in' is therefore not allowed access.





如何修复?



我尝试了什么:



我搜索了谷歌和stackoverflow但是每个人都提供教程关于如何将WordPress网站迁移到https或如何修复CORS问题。



我尝试在代码中搜索,我可以将链接更改为https因此原点变得相同但无法找到位置。



请在代码或WordPress管理面板中建议我应该修复此



How to fix?

What I have tried:

I have searched on google and stackoverflow but everyone is providing tutorial either about "how to migrate WordPress site to https" or "how to fix CORS issue".

I tried myself searching in the code where I can change the link to https so the origin becomes same but unable to locate the location.

Please suggest where in the code or WordPress admin panel I should fix this

推荐答案

没有资源的绝对链接(即那些也包含域名的资源),请使用'/ wp-content / themes / academia / dist / fonts / montserrat / montserrat- regular-webfont.woff2'而不是。这样它将使用与请求它的页面相同的域和协议。
Don't have absolute links to resources (ie ones that have the domain in them too), use ones like '/wp-content/themes/academia/dist/fonts/montserrat/montserrat-regular-webfont.woff2' instead. That way it will use the same domain and protocol that the page requesting it is.


这篇关于WordPress网站原点已被CORS政策阻止:在将网站迁移到SSL(https)证书后没有'access-control-allow-origin'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆