问题描述
我正在Heroku中部署Vue + Django应用程序,但是Django在显示上述错误的vuejs方面运行良好。我需要更改“ http://127.0.0.1:8080”的位置。实际上,Django模板运行良好,但是进入未显示的Vue js文件,出现以下错误
Uncaught Error: SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS
at new SockJS (sockjs.js?9be2:689)
at new SockJSClient (SockJSClient.js?0a33:43)
at initSocket (socket.js?e29c:20)
at Object.eval (client?7017:176)
at eval (index.js?http://127.0.0.1:8080&sockPath=/sockjs-node:177)
at Object../node_modules/webpack-dev-server/client/index.js?http://127.0.0.1:8080&sockPath=/sockjs-node (bundle.js:9374)
at __webpack_require__ (bundle.js:790)
at fn (bundle.js:101)
at Object.1 (bundle.js:9967)
at __webpack_require__ (bundle.js:790)
vue.config.js
const BundleTracker = require("webpack-bundle-tracker");
module.exports = {
// on Windows you might want to set publicPath: "http://127.0.0.1:8080/"
transpileDependencies: ["vuetify"],publicPath: "http://127.0.0.1:8080/",outputDir: './dist/',chainWebpack: config => {
config
.plugin('BundleTracker')
.use(BundleTracker,[{filename: './webpack-stats.json'}])
config.output
.filename('bundle.js')
config.optimization
.splitChunks(false)
config.resolve.alias
.set('__STATIC__','static')
config.devServer
// the first 3 lines of the following code have been added to the configuration
.public('http://127.0.0.1:8080')
.host('127.0.0.1')
.port(8080)
.hotOnly(true)
.watchOptions({poll: 1000})
.https(false)
.disableHostCheck(true)
.headers({"Access-Control-Allow-Origin": ["\*"]})
},//uncomment before executing 'npm run build'
css: {
extract: {
filename: 'bundle.css',chunkFilename: 'bundle.css',},}
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)