10

Trying out Puma as my Rails server.

Anybody know why the Puma rails server only accepts localhost:3000 rather than 127.0.0.1:3000?

I'm going to want to test Facebook OAuth, and that will need an IP address.

justingordon
  • 12,553
  • 12
  • 72
  • 116

3 Answers3

16

Have you tried rails s -b 127.0.0.1 -p 3000? That's always worked for me.

Cody Duval
  • 336
  • 1
  • 3
1

Try env PORT=port_number rails s -b your_IP_Address And the server will start on https://your_IP_Address:port_number

dArK kNiGhT
  • 151
  • 2
  • 12
0

This problem was Puma issue #782 and was solved on July 18, 2016 with this patch.

Details: The problem you see is that Puma by default binds to localhost, which was treated as a normal hostname by the underlying Rails TcpServer and there resolved to only one IP address (the IPv6 version in your case) but not to both the IPv4 and IPv6 versions. Due to this, it was not accepting connections on 127.0.0.1:3000 as you saw. In current versions however, an exception is made specifically for localhost, which now binds to both the IPv4 and IPv6 resolutions.

tanius
  • 14,003
  • 3
  • 51
  • 63