Report this

What is the reason for this report?

127.0.0.1:5000 ERR_CONNECTION_REFUSED from react app but curl and browser works

Posted on November 14, 2020

Hi,

I have a droplet with a react app and a flask server (uwsgi). React app is accessible via http://server_ip:3000/ Flask Server is accessible via http://server_ip:5000/

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 ERR_CONNECTION_REFUSED.

No firewall (ufw) has been set-up.

Running both app via systemd via the following comment: React: /usr/bin/serve -s /path/to/build -l 3000 Flask server: /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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.