summaryrefslogtreecommitdiffhomepage
path: root/frontend/src/setupProxy.js
blob: 72a62ba58896f213941063e7571872b3045b5759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { createProxyMiddleware } = require("http-proxy-middleware");

const target = process.env["REACT_APP_PROXY_URL"];
const allowWs = process.env["REACT_APP_ALLOW_WEBSOCKET"] === "true";
const secure = process.env["REACT_APP_PROXY_SECURE"] === "true";

module.exports = function (app) {
  app.use(
    createProxyMiddleware(["/api", "/images", "/test", "/bazarr.log"], {
      target,
      changeOrigin: true,
      secure,
    })
  );
  app.use(
    createProxyMiddleware("/api/socket.io", {
      target,
      ws: allowWs,
      changeOrigin: true,
      secure,
      logLevel: "error",
    })
  );
};