WordPress 子域的访问控制允许 Origin 错误
Access Control Allow Origin error with WordPress subdomain
我的 WordPress 网站出现问题,它有一个子域 blog.domain.com,当我访问博客时,我的控制台出现以下错误:
从来源 blog.domain.com
访问 www.domain.com/wp-content/themes/Divi/core/admin/fonts/modules.ttf
处的字体已被 CORS 策略阻止:请求的资源上不存在 Access-Control-Allow-Origin
header。
目前,我的网站托管在 Azure 中,我尝试在我的托管选项中激活选项 "Cross-Origin Resource Sharing - Cors",它解决了问题,但它使网站变慢了很多(16 秒),所以我'我正在寻找解决此问题的方法。
如果有人知道我该如何解决这个问题,欢迎提出建议,我将不胜感激!
谢谢
如果您使用 windows azure web 应用程序,我建议您可以尝试访问以下 url:
https://yourwebappname.scm.azurewebsites.net/DebugConsole
然后你应该去 site\wwwroot 找到 web.config 文件并添加以下配置设置:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
我的 WordPress 网站出现问题,它有一个子域 blog.domain.com,当我访问博客时,我的控制台出现以下错误:
从来源 blog.domain.com
访问 www.domain.com/wp-content/themes/Divi/core/admin/fonts/modules.ttf
处的字体已被 CORS 策略阻止:请求的资源上不存在 Access-Control-Allow-Origin
header。
目前,我的网站托管在 Azure 中,我尝试在我的托管选项中激活选项 "Cross-Origin Resource Sharing - Cors",它解决了问题,但它使网站变慢了很多(16 秒),所以我'我正在寻找解决此问题的方法。
如果有人知道我该如何解决这个问题,欢迎提出建议,我将不胜感激!
谢谢
如果您使用 windows azure web 应用程序,我建议您可以尝试访问以下 url:
https://yourwebappname.scm.azurewebsites.net/DebugConsole
然后你应该去 site\wwwroot 找到 web.config 文件并添加以下配置设置:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>