Can't connect to http://localhost:3000 [Rails 5]

rails

#1

I can’t get ActionCable to work because its default server URL is http://localhost:3000 if the server is running in development. When I run rails s -b $IP -p $PORT it connects to 8080 by default.

=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options

So I tried running rails s -b $IP -p 3000 instead:

Booting Puma
=> Rails 5.0.0.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options

Although it seems to have connected to http://localhost:3000 alright, when I click on http://0.0.0.0:3000 and select Open, the page doesn’t load and I get a ERR_CONNECTION_TIMED_OUT error. I disabled my firewall to no avail. What am I doing wrong?


#2

Please refer to this page here. https://docs.c9.io/docs/multiple-ports

The IP 0.0.0.0 is a universal listen ip, you cannot connect directly to it from the outside. Use the c9users.io address associated with your workspace to access servers running on it.

also, localhost maps to 127.0.0.1. also an address that only works on that machine. if you type it into your browser, it will look for services on your computer, not on the internet.