Proxy Error from backend API to frontend react app

Proxy error: Could not proxy request /api/v1/products from
localhost:3000 to http://192.168.137.1:4000.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ETIMEDOUT).

this error keep on coming.
Frontend -> React
Backend-> Express, nodejs

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I faced a similar issue but in the Mac machine. I changed localhost to 127.0.0.1 and that worked for me.

For Windows:

"proxy": {
  "/auth/google": {
    "target": "localhost:5000"
  }
}

For Mac:

"proxy": {
  "/auth/google": {
    "target": "http://127.0.0.1:5000"
  }
}

Method 2

I just changed "proxy": "http://192.168.137.1:4000" to "proxy": "127.0.0.1:4000" and this worked for me now…

This is done on windows


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x