aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-21 17:51:49 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-21 17:51:49 -0700
commit69a38ffe392ca4bae7daf82a50c9b9d2166fae28 (patch)
tree1ffc3f380c6cbae858dd6819a03cbd39cdd78a25
parent95cbf0277936012c01e46c2a3625d5bdeebb48ae (diff)
downloadetbsa-traccar-web-69a38ffe392ca4bae7daf82a50c9b9d2166fae28.tar.gz
etbsa-traccar-web-69a38ffe392ca4bae7daf82a50c9b9d2166fae28.tar.bz2
etbsa-traccar-web-69a38ffe392ca4bae7daf82a50c9b9d2166fae28.zip
Fix websocket proxy
-rw-r--r--modern/package.json2
-rw-r--r--modern/src/setupProxy.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/modern/package.json b/modern/package.json
index d5eaa13..d4ce955 100644
--- a/modern/package.json
+++ b/modern/package.json
@@ -5,6 +5,7 @@
"dependencies": {
"@material-ui/core": "^4.9.7",
"@material-ui/icons": "^4.9.1",
+ "mapbox-gl": "^1.8.1",
"ol": "^6.2.1",
"ol-mapbox-style": "^6.0.1",
"react": "^16.13.0",
@@ -21,7 +22,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
- "proxy": "http://localhost:8082",
"browserslist": {
"production": [
">0.2%",
diff --git a/modern/src/setupProxy.js b/modern/src/setupProxy.js
new file mode 100644
index 0000000..71312d5
--- /dev/null
+++ b/modern/src/setupProxy.js
@@ -0,0 +1,6 @@
+const proxy = require('http-proxy-middleware');
+
+module.exports = function(app) {
+ app.use(proxy('/api/socket', { target: 'ws://localhost:8082', ws: true }));
+ app.use(proxy('/api', { target: 'http://localhost:8082' }));
+};