问题描述
我有一个服务器和一个指向它的域B.最近,我购买了一个新域A并重定向到B.我删除了A,因为在加载字体时开始出现此错误.
I have a server and a domain B pointing to it. Recently I bought a new domain A and did a redirection to B. I removed A because this error started appearing when loading fonts.
Redirect from 'A' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present
on the requested resource. Origin 'B' is therefore not allowed access.
我了解A指向的服务器必须配置为具有访问控制允许来源"的来源,但是域A只是我在主机上进行的重定向,因此没有我可以访问的服务器,去做这个.我已经删除了服务器A以重定向到B.
I understand that server where A is pointing must be configured to have 'Access-Control-Allow-Origin' origin but domain A only was a redirection which I did on my hosting so there is no server that I have access to, to do this. I have already removed server A to redirect to B.
如何解决?
这两个域名都是从godaddy购买的,服务器托管在aws中,我已经修改了.htaccess来相应地设置geaders,但是没有运气.
Both domains were bought from godaddy, server is hosted in aws and I have already modified the .htaccess to set the geaders accordingly but no luck.
推荐答案
如果您可以控制来源B,则将以下代码添加到来源B的.htaccess中
Add following code to .htaccess of Origin B if you have control over origin B
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
您还可以根据需要编辑该代码.
You can also edit that code according to your need.
这篇关于从A重定向已被CORS策略阻止.因此,不允许起点B的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!