After the vuE-CLI4.0 project is packaged, the reverse proxy configured in the local vue.config.js does not work:
module.exports = {
runtimeCompiler: true.publicPath: '[{[ .StaticURL ]}]'.// publicPath: '/static',
lintOnSave: false.devServer: {
proxy: {
'/netapi': {
/*target is the target address you want to cross the domain */
target: 'http://xxx.xxx.xxx.com:86/'.changeOrigin: true.pathRewrite: {
'^/netapi': ' '
}
}
}
}
}
Copy the code
After the project is packaged online, you need to configure the proxy in nginx to request the target interface:
server { listen 8080; server_name localhost; charset utf-8; access_log logs/host.access.log main; Location / {/*1, nginx configuration does not work */# root C:\mpro\ser\frontend\dist;index index.html index.htm; */ proxy_pass http://localhost:8080/ */ proxy_pass http://localhost:8080/ } the location/netapi / {/ * 3, I is the address of the request agent oh * / proxy_pass http://xxx.xxx.xxx.com:86/; client_max_body_size 10M; } /* If baseurl.js has been created in our project, we will directly request/API/XXX.'baseURL/api/xxx', such as (http://localhost:8080/api/xxx) if in nginx configuration/API, so there will be a conflict that is supposed to request local/API address was nginx proxy, so there is a mistake (and request is less than the target address), so I note it out! */ /*localhost /api { client_max_body_size 10M; } * /Copy the code
Ii. Git Regret Medicine Series:
Git reset –hard XXX (some version) I’m doing a lot better, aren’t I? How to do? Then he began to be cold, still, xia; Git reflog can query all its operation history.
Scroll down to see this mischievous command (yes, the same one that made little A nearly collapse) :
Git reset –hard de452e6;
And just like that, little A’s code finally came back!