Reputation: 3357
I'm trying to connect my iPhone/iPad to localhost:3000 which runs my rails app. With my older mac I could access it easily through ben.local Since my battery just exploded on that old laptop, I cannot even see the settings (seriously, I'm not making this up). I imagine I went to ben.local:3000
But with my new laptop, running Mavericks, that does not work.
I enabled apache (web sharing, right?) so I can see the enthusiastic "It works!" page on ben.local, but ben.local:3000 does not show me the app. Also on my laptop it doesn't. In fact, on the laptop, I can only access it through localhost:3000 and 127.0.0.1:3000
Indeed, I can use ngrok, but prefer not to.
Any ideas how I can access the app at ben.local:3000?
Upvotes: 3
Views: 1355
Reputation: 3357
OK, so here's what you do if you face this issue:
Run your rails server on the ip address of your network. on a Mac - ifconfig or go to sys prefs and then Network. It will show you what your network ip address is.
Then in Terminal start your rails server and replace the X with your ip address:
rails s -b XXX.XXX.XXX.XXX
Then on your mobile device go to that ip address on port 3000, so XXX.XXX.XXX.XXX:3000
Make sure your mobile and your local computer are on the same network, of course.
Upvotes: 7