forked from platypush/platypush
A proper way to proxy websocket calls using the Vue devServer.
This commit is contained in:
parent
78c12212c6
commit
6b0f0883ee
1 changed files with 27 additions and 25 deletions
|
@ -1,4 +1,21 @@
|
||||||
|
const httpProxy = {
|
||||||
|
target: 'http://localhost:8008',
|
||||||
|
changeOrigin: true
|
||||||
|
}
|
||||||
|
|
||||||
|
const wsProxy = {
|
||||||
|
target: 'http://localhost:8008',
|
||||||
|
changeOrigin: false,
|
||||||
|
ws: true,
|
||||||
|
onProxyReq: function(request) {
|
||||||
|
console.log('===== HERE');
|
||||||
|
console.log(request);
|
||||||
|
request.setHeader('Origin', 'http://localhost:8008');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
lintOnSave: true,
|
||||||
outputDir: "dist",
|
outputDir: "dist",
|
||||||
assetsDir: "static",
|
assetsDir: "static",
|
||||||
css: {
|
css: {
|
||||||
|
@ -14,31 +31,16 @@ module.exports = {
|
||||||
|
|
||||||
devServer: {
|
devServer: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/execute': {
|
'/execute': httpProxy,
|
||||||
target: 'http://localhost:8008',
|
'/ws/events': wsProxy,
|
||||||
changeOrigin: true
|
'/ws/requests': wsProxy,
|
||||||
},
|
'/static/*': httpProxy,
|
||||||
'/ws/events': {
|
'/auth': httpProxy,
|
||||||
target: 'http://localhost:8008',
|
'/login': httpProxy,
|
||||||
ws: true,
|
'/logout': httpProxy,
|
||||||
changeOrigin: true
|
'/register': httpProxy,
|
||||||
},
|
'/camera/*': httpProxy,
|
||||||
'/auth': {
|
'/sound/*': httpProxy,
|
||||||
target: 'http://localhost:8008',
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
'/logout': {
|
|
||||||
target: 'http://localhost:8008',
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
'/camera/*': {
|
|
||||||
target: 'http://localhost:8008',
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
'/sound/*': {
|
|
||||||
target: 'http://localhost:8008',
|
|
||||||
changeOrigin: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue