Proxying localhost requests throws ECONNRESET errors when using parceljs with nodejs on debian OS

Viewed 175

I have 2 apps running on different ports.

  1. API - http://localhost:3000
  2. UI - http://localhost:3001

UI is running via dev mode of parcel.

I need to forward all requests from UI app (3001) to API (3000)

I tried to use .proxyrc approach https://parceljs.org/features/development/#.proxyrc-%2F-.proxyrc.json with next configuration:

{
    "/api": {
        "target": "http://localhost:3000/",
        "changeOrigin": true
    }
}

Also, I tried using .proxyrc.js https://parceljs.org/features/development/#.proxyrc.js

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

module.exports = function (app) {
  app.use(
    createProxyMiddleware("/api", {
      target: "http://localhost:3000/",
      changeOrigin: true,
    })
  );
};

Unfortunately every time I get such an error when a request comes:

console: [HPM] Error occurred while proxying request localhost:3001/api/v2/client-config to http://localhost:3000/ [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)

Other team members with Debian and other linuxes have no such issues.

Could someone help me with that please ?

  • OS: Debian GNU/Linux 11 (bullseye)
  • nvm: 0.39.1
  • node: v14.18.2
  • npm: 8.3.1
  • http-proxy-middleware: ^2.0.6
0 Answers
Related