127.0.0.1:5000 ERR_CONNECTION_REFUSED from react app but curl and browser works
I have a droplet with a react app and a flask server (uwsgi).
React app is accessible via
Flask Server is accessible via
My ReactApp is fetching data from my flask server via http://127.0.0.1:5000 as they are both hosted on the same server.
curl http://127.0.0.1:5000 from the server works perfectly.
However, when accessing the react app, it is showing 127.0.0.1:5000 ERRCONNECTIONREFUSED.
No firewall (ufw) has been set-up.
Running both app via systemd via the following comment:
/usr/bin/serve -s /path/to/build -l 3000
/path/to/project/venv/bin/uwsgi --ini=uwsgi.ini --http :5000
I have tried replacing 127.0.0.1 with 0.0.0.0 and I have tried changing the port.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×