Cors in Ajax Meet 302 Redirect

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Cors in Ajax Meet 302 Redirect



I have a front-end server with port 8081
a background server with port 8080(Spring MVC + shiro)



When I send a request to 8080 , I have to set the cors headers on 8080



if the request is a simply request which only returns some json datas, it works



But When the response status is 302, Chrome shows 'Redirect from 'http://localhost:8080/' to 'http://localhost:8080/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.'



I thought there are two reasons to occur this problem:



① if I intercept this 302 status, and deal this response.headers.Location,
I will solve this. But I can't intercept this response(with axios)



② Maybe some settings is wrong with 8080 server, when 302 occurs, the serve haven't set the cors Headers for this page. But I don't understand the backend code.



So, ① is feasible? or I need to change the settings on 8080 server?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty