赞
踩
devServer: { host: '0.0.0.0', port: port, open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { // target: `http://localhost:8080`, 注释掉默认配置,修改为如下ip配置 target: `http://你远程服务器的ip(例如x.x.x.x):8080`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' } } }, disableHostCheck: true },
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/; 这是原来的配置可以删除这行
proxy_pass http://服务器的ip地址:8080/;
}
修改如上两处配置即可
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。