I am working on a project with Node.js, React.js and MongoDB.
When I send request to server, I get the following error:
Error occurred while trying to proxy request
/api/auth/login
fromlocalhost:3000
tohttp://localhost:6000
(ECONNRESET).
I have my client running at port 3000, server at port 6000 locally. Here is the client side proxy middleware setup code:
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(proxy("/api/", { target: "http://localhost:6000", "secure": "false" }));
};
I have tried using 127.0.0.1
inplace of localhost
, but didn't work.
The project works fine in Windows laptop. But, it is having problem with M1 Mac.
Any guidance would be of great help to me.