quick proxy test

This commit is contained in:
proddy
2021-04-01 17:49:43 +02:00
parent 3bacfc3361
commit d553542206
12 changed files with 3212 additions and 191 deletions

View File

@@ -1,11 +1,7 @@
# Change the IP address to that of your ESP device to enable local development of the UI.
# Remember to also enable CORS in platformio.ini before uploading the code to the device
# with -DENABLE_CORS
# Change the IP address to that of your ESP device to enable local development of the UI
# my Wifi
#REACT_APP_HTTP_ROOT=http://10.10.10.101
#REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.101
REACT_APP_HTTP_ROOT=http://localhost:3000
# my Ethernet
REACT_APP_HTTP_ROOT=http://192.168.1.134
REACT_APP_WEB_SOCKET_ROOT=ws://http://192.168.1.134
# REACT_APP_HTTP_ROOT=http://172.17.233.73:3000
# REACT_APP_WEB_SOCKET_ROOT=ws://localhost:3000

View File

@@ -36,6 +36,7 @@
"zlib": "^1.0.5"
},
"devDependencies": {
"http-proxy-middleware": "^0.19.1",
"react-app-rewired": "^2.1.8"
}
},

View File

@@ -51,6 +51,8 @@
]
},
"devDependencies": {
"react-app-rewired": "^2.1.8"
"http-proxy-middleware": "^0.19.1",
"react-app-rewired": "^2.1.8",
"concurrently": "^4.1.0"
}
}

View File

@@ -0,0 +1,15 @@
const createProxyMiddleware = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/rest/*',
createProxyMiddleware({
target: 'http://localhost:3080',
secure: false,
changeOrigin: true,
// pathRewrite: {
// '^/api/settings': '/api/app/settings'
// },
})
);
};

11
interface/x Normal file
View File

@@ -0,0 +1,11 @@
> esp8266-react@0.1.0 start
> react-app-rewired start
[HPM] Proxy created: / -> http://localhost:3080
 「wds」: Project is running at http://172.17.233.73/
 「wds」: webpack output is served from
 「wds」: Content not from webpack is served from /home/paul/dev/EMS-ESP32/interface/public
 「wds」: 404s will fallback to /
Starting the development server...