问题
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