4
2
I'm building a Rails application on my local dev machine. When running my local server, I can access http://localhost:3000
without a problem. However, when I try to navigate to http://127.0.0.1:3000
, I get an ERR_CONNECTION_REFUSED
. Normally, I won't care about this problem, but when I try to access a tunnel using ngrok
, I get this error:
Tunnel <URL> unavailable
Unable to initiate connection to 127.0.0.1:3000. A web server must be running on port 127.0.0.1:3000 to complete the tunnel.
I did a clean install of OS X this morning, and the only things running on my system are what's in my dotfiles readme. Here's my complete /etc/hosts
file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
3Odds are, when you are using localhost it isle fearing IPv6. So perhaps the server is not running on IPv4 or more likely only the IPv6 port is allowed through firewall. – YLearn – 2015-04-25T19:32:12.347
1Good call! I rebooted the Rails server using
-b ::
to listen for IPv4 and IPv6 and it worked! I didn't realize Puma wouldn't do this by default. Can you toss your comment in an answer so I can mark it as the accepted answer? Thanks for the help! – LandonSchropp – 2015-04-25T19:42:07.597