What is the reason why Access-Control will report name.toUpperCase is added to axios request interception?

problem description

the Access-Control-Allow-Origin cross-domain request has been added at the backend. I added Access-Control-Allow-Origin, in the axios request interception, but the browser reported an error name.toUpperCase is not a function. I don"t know what caused it.

the environmental background of the problems and what methods you have tried

Google hasn"t found a solution to the problem all morning

related codes

/ / Please paste the code text below (do not replace the code with pictures)
before adding Access-Control-Allow-Origin, the browser reports an error like this




what result do you expect? What is the error message actually seen?

this is a vue project. You want to add cross-domain when intercepting a request so that you can access the interface normally.

I wonder if it is clear to ask questions when using vue, for the first time. Please help me a lot.

Apr.27,2021

vue front end is equipped with other environments to solve cross-domain local development powerless
question is: do you add request response header?
configure the backend Access-Control-Allow-Origin as *
then you directly request, ah,


the problem itself is problematic.

first of all, Access-Control-Allow-Origin is to add the back-end service to the header of response, not to the requested header as you did in your question. Check the response header of the API for the field Access-Control-Allow-Origin , and if so, see what the value is.

secondly, you add header in the wrong way, config.headers is an object, if you want to add it is also through config.headers = {} way to add, and your way is to set the headers to a string (look at the document, understand it).

you say that you have been Google all morning, but it is probably in the wrong direction. You can take this opportunity to Google the cross-domain solution of the data interface front end and understand it.


Access-Control-Allow-Origin should be added to response. So I don't understand what you're doing

Menu