Redirect from A has been blocked by CORS policy. Origin B is therefore not allowed access

旧时模样 提交于 2019-12-12 02:29:29

问题


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.

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.

How is this solved?

Edit:

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.


回答1:


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.



来源:https://stackoverflow.com/questions/43816797/redirect-from-a-has-been-blocked-by-cors-policy-origin-b-is-therefore-not-allow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!