After the vue axios request backend is set to allow cross-domain, what should I do if the get request becomes an options request?

what should I do when the vue axios request backend is set to allow cross-domain get requests and becomes options requests?


:


Mar.25,2021

first learn what an options request is and why there is an options request. This is a request that usually occurs when you set Cors for cross-domain operations, and it is a normal request.


this is a normal operation, and you don't need to solve it. You just need to care about whether the data has been requested.


the request header of the backend is not complete.
if I remember correctly, content-type is also added, can't you add it?
options operation is to say hello first, the basic operation is ignored, and the general framework will handle it.

update:
options request to communicate with browser to allow custom header,. There is no from, in your return. You have customized the contenttype, to be added to the post request.
clipboard.png


add a @ CrossOrigin annotation to the backend method, which seems to be the content after spring4.2, to solve cross-domain problems

.
Menu