Home > front end >  Axios how to handle the request redirection cross-domain problem
Axios how to handle the request redirection cross-domain problem

Time:11-15

Business process looks something like this: axios backend initiate the request, the back-end redirect requests, that is to say, return a status code of 302, the response headers directional address, the location of the first browser to an error at this moment, could you tell me how to deal with this problem?

CodePudding user response:

Production environment cross-domain only two solutions
1. Modify the server, set Access - Control - Allow - Origin to your domain name or client *
2. Modify the client, the use of domain name is the same as the server domain name,
Development environment can also be allowed to cross domain such as Chrome, set such as Chrome can set - disable - web - security - user - data - dir="C:/ChromeTempDir", in which "C:/ChromeTempDir" for a custom folder,
  •  Tags:  
  • Ajax
  • Related