Create a UI proxy setup

This commit is contained in:
Alex Tselegidis 2022-05-27 10:42:06 +02:00
parent 547174e037
commit c14f5a3528
2 changed files with 12 additions and 0 deletions

View File

@ -2,3 +2,4 @@ PORT=3000
CHOKIDAR_USEPOLLING=true
REACT_APP_BASE_URL=api.php
REACT_APP_VERSION=1.0.0-beta.4
REACT_APP_PROXY_HOST=http://localhost:8080

11
client/src/setupProxy.js Normal file
View File

@ -0,0 +1,11 @@
const createProxyMiddleware = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
process.env.REACT_APP_BASE_URL, // You can pass in an array too eg. ['/api', '/another/path']
createProxyMiddleware({
target: process.env.REACT_APP_PROXY_HOST,
changeOrigin: true,
})
);
};