Axios sent get requests twice, both of which were get requests to solve the problem.

use axios to send a get request twice. Many people on the Internet say that it is due to a cross-domain problem, so axios will first send an option pre-check request (preflight request), to know whether the server allows the cross-domain request.

but I have two get requests here, I would like to ask the gods, what is going on?

Mar.16,2021

this has nothing to do with cross-domain. Is your port 8080 nodejs snooping or nginx snooping and reverse proxy?


code executed twice


service problem, 301 redirect. Redirect robotstatus? to robotstatus/? and check where the redirection is made between the start of the request and the completion of the server response.


because you have been redirected, you can think of two
requests as one request.


the browser first sends a request, which is returned by the backend, telling the front-end browser that the resource you want to access has a new address (that is, redirected), and the browser sends the correct request again, so there will be two

.
Menu