You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The frontend is in react (non ejected) and the backend is in python, listening to port 5000. I have added to /etc/hosts the names that are required for the project to work (lists.local for the main app, redis.local, etc.) so that I can get a local development environment reasonably closer to what will be found in production. This setup runs correctly whenever I build the react app and go for everything production like. However, whenever I run "npm run start", the requests are not forwarded to the backend.
Contents of setupProxy.js (I only need to forward anything below /api):
EDIT: This is getting more and more weird: if I copy (but not if I move) the file setupProxy.js to the frontend folder (so that the same file is found in frontend and in frontend/src) the requests are forwarded. Otherwise, nothing. This feels wrong....
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a toy project to learn about react, and I have it structured like
The frontend is in react (non ejected) and the backend is in python, listening to port 5000. I have added to /etc/hosts the names that are required for the project to work (lists.local for the main app, redis.local, etc.) so that I can get a local development environment reasonably closer to what will be found in production. This setup runs correctly whenever I build the react app and go for everything production like. However, whenever I run "npm run start", the requests are not forwarded to the backend.
Contents of setupProxy.js (I only need to forward anything below /api):
In package.json I have the following entry:
What am I doing wrong?
EDIT: This is getting more and more weird: if I copy (but not if I move) the file setupProxy.js to the frontend folder (so that the same file is found in frontend and in frontend/src) the requests are forwarded. Otherwise, nothing. This feels wrong....
Beta Was this translation helpful? Give feedback.
All reactions