[ACCEPTED]-Allow public connections to local Ruby on Rails Development Server-ruby

Accepted answer
Score: 212

The simplest way requires NO additional installations: just add a single 7 option to your rails server (or rails s) command when you start 6 up the server:

rails s --binding=

The address means "listen 5 to requests from anywhere." On many systems, the 4 default is, which means "listen to requests 3 from localhost only."

(If you don't also 2 specify a -p or --port option, then the port shall 1 be 3000, as usual.)

Score: 27

You can tell your development server to 11 listen on your publicly accessible interface:

If 10 you're running a server via rails server, you can specify 9 the IP to listen on via -b <ip> or --binding=<ip>. By default, the 8 server listens on, that is, only 7 for local connections.

Usage: rails server [mongrel, thin, etc] [options]
    -p, --port=port                  Runs Rails on the specified port.
                                     Default: 3000
    -b, --binding=ip                 Binds Rails to the specified ip.

You can instead find 6 out what your machine's network address 5 is and bind to that address instead, but 4 you will have to forward ports and figure 3 out what your publicly routable IP address 2 is on the Internet; this is outside the 1 bounds of Stack Overflow.

Score: 22

Give localtunnel a go. It's a ruby gem so you shouldn't 8 have any problem getting it going:

gem install localtunnel
localtunnel 3000

The first 7 time you do that it'll ask you for an ssh 6 key, but once you've got that set it'll 5 show you the public url that you can share. Anything 4 running on the specified port will get exposed 3 at that url.

Showoff-io looks like a similar 2 service, but I haven't used it so I can't 1 comment. Also, it's paid and requires signup.

Score: 7

As someone suggested, use ngrok.

It's stupidly 1 easy.

Score: 2

Allow remote connections by binding the 4 Rails server to

Here's the short 3 notation for those who don't like typing 2 😊:

bin/rails s -b

If you also want to allow IPv6 connections 1 (Puma):

bin/rails s -b [::]

More Related questions