Guys, do I still need to change proxyTable when I go online? get down on your knees and ask for answers.
proxyTable: {
"/api":{
target: "https://app.hsltm.com",
changeOrigin: true,
pathRewrite: {
"^/api": "/api"
}
},
"/ssm-api": {
target: "https://appdb.hsltm.com",
changeOrigin: true,
pathRewrite: {
"^/ssm-api": "/ssm-api"
}
},
"/wxapi-web": {
target: "https://appdb.hsltm.com",
changeOrigin: true,
pathRewrite: {
"^/wxapi-web": "/wxapi-web"
}
}
},
--------------
Broadcast () {
let that = this
that.axios({
url: "/wxapi-web/...",
method: "get",
}).then((response) => {
that.swiperLists = response.data.pageInfo.list
})
},
-------------
web
launch requires background configuration to allow cross-domain problems or nignx to configure agents to solve
what's wrong with stepping on me? Am I wrong? Are you stupid? It's really annoying
what you are writing now proxyTable
are all configuration packages in the development phase and will not type these things
add:
axios({
url: '/wxapi-web/...',
method: 'get',
})
you url
the absolute path you use to access the page https://abc.com
, then your path to this path is https://abc.com//wxapi-web/.
.
1. Web server-> API server (set cross-domain) address: https://appdb.hsltm.com
you can:
axios({
url: 'https://appdb.hsltm.com/wxapi-web/...',
method: 'get',
})
or
var instance = axios.create({
baseURL: 'https://appdb.hsltm.com/',
});
instance({
url: '/wxapi-web/...',
method: 'get',
})
var instance2 = axios.create({
baseURL: 'https://def.com/',
});
instance2({
url: '/wxapi-web/...',
method: 'get',
})
2. Web server (set proxy function)-> Interface server
what do you use to start web server if your web server can set cross-domain code without modifying
3. Web Server-> proxy Server-> Interface Server
Code is the same as 1
url
to be written as proxy server address
will automatically match. There is no need to modify
Why, you need to run webpack dev server? on the server.