I have been trying to perform a cross domain redirection to (https://www.google.com) from my spring controller as mentioned here (Redirect to dynamic URL in Spring MVC).
However, I'm getting an error stating that the redirect to the URL has been blocked by CORS policy as the 'Access-Control-Allow-Origin' header is not present on the request resource.
How can I fix this error?
Asked
Active
Viewed 3,307 times
0

Community
- 1
- 1

Abhigyan Mehra
- 215
- 1
- 4
- 7
-
I have already tried adding the header in the HttpServletResponse object - reponse.setHeader("Access-Control-Allow-Origin", "*") – Abhigyan Mehra Nov 21 '16 at 17:40
1 Answers
0
When you redirect to third party sites you need to enable Cross-Origin Resource Sharing (CORS). You getting this error bcoz it wouldn’t be allowed under the browser’s same origin policy. Modified your header for Cross-Origin Resource Sharing (CORS) in the response. You will find more information about Spring CORS support Here (Spring docs)

Onkar
- 679
- 1
- 8
- 25