Webpack-dev-server solves cross-domain problems

the front and back ends are developed separately, and ajax is used to access the background interface.
solved this cross-domain problem for the first time, and I don"t know what went wrong.
there is really nothing I can do.

js Code

url:"/v1/user/login",
data:"username=" + loginUserName + "&password="+loginUserPassword,
type:"get",
dataType:"json",
success:function(data){
    location.href = "../index/index.html";
},
failure:function(){
    alert("");
}

webpack.config.js configuration is written like this

    devServer: {
        historyApiFallback: true,
        hot: true,
        inline: true,
        progress: true,
        proxy: {
            "/v1/*": {
                target: "http://192.xxx.xxx.xxx:8080",//
                changeOrigin: true,
                secure: false,
            }
        }
    },

Code display:

clipboard.png

jsonp

js


clipboard.png


the old man put

url:'/v1/user/login',
data:"username=" + loginUserName + "&password="+loginUserPassword,
type:'get',
dataType:'json',
success:function(data){
    location.href = "../index/index.html";
},
failure:function(){
    alert("");
}
Change

to

url:'/user/login',
data:"username=" + loginUserName + "&password="+loginUserPassword,
type:'get',
dataType:'json',
success:function(data){
    location.href = "../index/index.html";
},
failure:function(){
    alert("");
}

try;


            
        proxy: {
            '/v1/*': {
                target: 'http://192.xxx.xxx.xxx:8080',//
                changeOrigin: true,
                secure: false,
                pathRewrite: {  
                '^/v1': ''
                }
             }
        }
        
refer to my previous article https://codeshelper.com/a/11."

confirm the interface to be requested first. If it is http://192.xxx.xxx.xxx:8080/v1/user/login
, write

.
proxy: {
            '/v1/*': {
                target: 'http://192.xxx.xxx.xxx:8080',//
                changeOrigin: true,
                secure: false,
                pathRewrite: {  
                '^/v1': '/v1'
                }
             }
        }

Request Method is changed to POST, background interface in REST style, which specifies the request type.
configuration modification of ajax request:

type:'post',
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-1ea7a48-1e71.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-1ea7a48-1e71.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?