Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Puma listen on 'tcp://localhost:3000' instead of 'http://localhost:3000'

I'm a Rails developer. There was a time I want to debug my Rails application runing in local on the mobile. So I tried to update my '/etc/hosts' to add the LAN ip(192.168.0.18) to localhost and make sure your laptop and mobile are connecting to the same LAN.

If I start my Rails application with 'Webwrick', it will listen on 'http://localhost:3000', then everything work well

But if I start my Rails application with 'Puma', it will listen on 'tcp://localhost:3000', and then I can't access the server by my LAN ip and port(192.168.0.18:3000)

like image 712
hiveer Avatar asked Aug 31 '25 22:08

hiveer


1 Answers

The HTTP protocol works on top of TCP, HTTP adds format to the raw TCP, so it kind of means the same thing. Given that Webrick and Puma are different HTTP servers, they may refer to the same thing in different ways. I hope this will be the worst of your problems during your journey with Rails! Enjoy!

like image 193
Andy Avatar answered Sep 04 '25 11:09

Andy