close

[Solved] How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’?

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’? in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’ Error Occurs?

Today I get the following error How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’? in javascript.

How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’ Error ?

  1. How to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header' Error ?

    to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header' Error Do specify @CrossOrigin(origins = "http://localhost:8081") in Controller class.

  2. How to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header'?

    to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header' Error Do specify @CrossOrigin(origins = "http://localhost:8081") in Controller class.

Solution 1

In addition to what awd mentioned about getting the person responsible for the server to reconfigure (an impractical solution for local development) I use a change-origin chrome plugin like this:

Moesif Orign & CORS Changer

You can make your local dev server (ex: localhost:8080) to appear to be coming from 172.16.1.157:8002 or any other domain.

Solution 2

Do specify @CrossOrigin(origins = "http://localhost:8081") in Controller class.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment