Search code examples
amazon-web-servicesamazon-ec2react-reduxdevopsaws-security-group

Cannot reach react application via dns hosted on ec2


I just want to see my development working on an EC2, showing to some friends, and think in deploying it after all of the work is done, but react doesn't cooperate. :/

I did everything I always do.

  • Started a ubuntu server on EC2

  • applied a group with 3000/tcp opened in my instance

  • Installed all dependencies of my app, npm 11.1 and its packages via npm install.

  • npm started it

  • and...

Nope.. there is no "and"... just my tears over a bunch of attempts without reaching 3000/tcp via public ip and dns..


I even tested ping on it.. set ICMP echo request and response rules, tested and it worked, but when I try to reach the application by 3000/tcp port, nothing.


Does someone have any idea?

As an image talk more than a thousand words, there it is... My nighmare

PS: a curl on localhost:3000 inside the ec2 works just fine.. while another curl outside the ec2 returns Connection Refused


Solution

  • Looks like the application is bound to localhost (127.0.0.1). Update your start property to include --host 0.0.0.0

    Refer: https://github.com/webpack/webpack-dev-server/issues/147