After configuring the proxy proxy in VUE, the front desk reported an error of 400bad request

problem description

use vue-cli to start the foreground port 8080 and the local eclipse to start the background port 8180, so you need to configure the proxy.
the proxy is configured according to CSDN"s tutorial, but the foreground browser reports an error
a href= "http://localhost" rel=" nofollow noreferrer "http://localhost:8080/api/springdemo/getUserByGet?userName=111 400 (Bad Request)
, and the backend cannot receive a message.

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

The

agent should actually be successful, because browsers can receive the returned results by directly accessing the http://localhost:8080/api/springdemo/getUserByGet?userName=111
, but not through the this.$ajax.post ( http://localhost:8080/api/springdemo/getUserByGet?userName=111", {}) access.

related codes

in config/index.js, introduce the following configuration.

proxy: {
    "/api": {    
        target: "http://localhost:8180",  // 
        changeOrigin: true,  //
        pathRewrite: {
            "^/api": ""   //  "/api"  "/"
        }
    }
}
looked at the normal startup project and configured the agent to start the log:
[HPM] Proxy created: / apis-> https://apitest.miaomore.com
[HPM] Proxy rewrite rule created:" ^ / apis "~ >"

but I carefully follow the tutorial, but did not type these two lines of agent log, indicating that there is still something wrong with the configuration, please take a look at it for me.

-follow-up supplement-

found that it was not that the agent did not take effect, but the front-end request reported an error of 403, which caused me to think that the agent was out of order.
currently, only login (POST) cannot achieve proxy access, and other get request proxies are available. Please help me with the analysis.

            this.$ajax.post("apis/login", {
                            domainAccount: this.loginForm.domainAccount,
                            password: this.loginForm.password
                        }).then((response) => {...}
May.03,2021

Let's take a look at the basics of http

.

first Baidu takes a look at the error message of http status code 403
and then tries to solve

.

finally, I recommend a good http book
"graphic http"
http://www.java1234.com/a/jav.

.

found that it was not that the agent did not take effect, but the front-end request reported an error of 403, which caused me to think that the agent was out of order.
currently, only login (POST) cannot achieve proxy access, and other get request proxies are available. Please help me with the analysis.

            this.$ajax.post('apis/login', {
                            domainAccount: this.loginForm.domainAccount,
                            password: this.loginForm.password
                        }).then((response) => {...}
                        
< hr >

the real solution, both foreground and background, are running locally.
https://blog.csdn.net/w770583.


analyze what to do with these two lines.
it's okay for you to post these two lines of code. Make it clear first:

403?
 Content-Type?
?
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37193-2c05b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37193-2c05b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?