+-
之前在服务器上部署了spring boot的后端,用本地的VUE项目链接服务器的后端,是可以登录的
但是用公网IP访问云上的项目就会向下图一样报错405
下图是本地VUE+云上spring boot的登录情况,可以登录
现在怀疑是配置问题,将登录界面的post方法,改成get了,请求可以发出去了(状态码是200)
但是没有response。不过到底是为什么呢?本地VUE可以可以收到,但是云端VUE就搜不到
config/index.js如下(人为扣掉公网IP):
var path = require('path')
module.exports = {
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report
},
dev: {
env: require('./dev.env'),
host: 'localhost',
//host: '公网IP',
//port: 9520 port: 8080,
autoOpenBrowser: true,
autoOpenPage: '/login',
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
// target: 'http://localhost:8080',
target: 'http://公网IP:8080',
pathRewrite: {
'^/api': '/'
}
}
},
}
}