Cors | vue | Vue admin template cors
Themostquestionbeaskedisstillaboutcross-domainissues.Infact,thecross-domainissueisreallynotaverydifficultquestiontosolve.HereIwillbrieflysummarizeseveralcross-domainsolutionsIrecommend.Themostrecommendedwayiscors,fullnameisCrossOriginResourceSharing.Thissolutiondoesnotmakeanydifferencetothefront-endwriterequestasusual.Theworkloadisbasicallyontheback-end.Foreachrequest,thebrowsermustfirstsendapre-requestasOPTIONS,toknowtheserver-sideHTTPmethodsupportedforcross-sourcerequests.Afterconfirmingth...
The most question be asked is still about cross-domain issues. In fact, the cross-domain issue is really not a very difficult question to solve. Here I will briefly summarize several cross-domain solutions I recommend.
The most recommended way is cors, full name is Cross Origin Resource Sharing. This solution does not make any difference to the front-end write request as usual. The workload is basically on the back-end. For each request, the browser must first send a pre-request as OPTIONS, to know the server-side HTTP method supported for cross-source requests. After confirming that the server allows the cross-source request, then send the real request with the actual HTTP request method. Details MDN Documentation[1]
The recommended reason is: as long as the first time is configured, no matter how many API interfaces and projects, they can be directly reused, and the cross-domain problem can be solved once and for all, and it can be conveniently used in both the deve...