aboutsummaryrefslogtreecommitdiff
path: root/modern/src/setupProxy.js
blob: d6b41582c659e919f712690d1c335e543eafff4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* eslint-disable import/no-extraneous-dependencies */

const { createProxyMiddleware } = require('http-proxy-middleware');


module.exports = (app) => {
  const proxy = createProxyMiddleware('/api/socket', { target: `ws://${process.env.REACT_APP_URL_NAME}`, changeOrigin: true, logLevel: 'debug' });
  const server = app.listen(3000);
  server.on('upgrade', proxy.upgrade);
  
  app.use('/api', createProxyMiddleware(`http://${process.env.REACT_APP_URL_NAME}/api`, { changeOrigin: true, headers: { "Connection": "keep-alive" }, logLevel: 'debug' }));
};