File size: 513 Bytes
6c68d01
 
fba4209
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Forwards dev server (npm start) requests to the Flask container.
// Defined here with ws: true because the package.json "proxy" field does not forward the socket.io WebSocket connection.
const { createProxyMiddleware } = require('http-proxy-middleware');

const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:7860';

module.exports = function (app) {
  app.use(
    createProxyMiddleware(['/api', '/socket.io'], {
      target: BACKEND_URL,
      changeOrigin: true,
      ws: true,
    })
  );
};