Viewing Rails from non-localhost using WEBrick server

During development, I’d like to see my Rails app from a computer other
than localhost on a Linux system and also want to change the default
port#. I thought this would do it:

Linux server:
$ script/server -b 10.4.1.84 -p 5432
=> Booting WEBrick…
=> Rails application started on http://10.4.1.84:5432
=> Ctrl-C to shutdown; call with --help for options

Windows browser URL:
http://10.4.1.84:5432/

BUT, the browser can’t find this and the WEBrick server on Linux shows
no activity.

Anyone know what gives?

Did you open that port (5432) under iptables?

–R

Did you open that port (5432) under iptables?

Don’t know for sure but I’ll check. I’m primarily a Windows developer,
just starting to move initial development over to Linux. The sys admin
gave me the port #.

(I’m in-between systems at the moment which is why I wanted to view the
app from my Windows system.)

btw, SHOULD the script work?

stan.baptista wrote:

Don’t know for sure but I’ll check. I’m primarily a Windows developer,
just starting to move initial development over to Linux. The sys admin
gave me the port #.

(I’m in-between systems at the moment which is why I wanted to view the
app from my Windows system.)

btw, SHOULD the script work?

To test open up lynx or some other console based web browser from the
Linux command line and point it to http://localhost:5432/ if that works
then it’s most likely iptables.

–R

I dunno if this helps but I added another domain in /etc/hosts.

127.0.0.1 localhost
127.0.1.1 [other mock domain name]

This indeed works great for testing two domains. Or at least it appears.
request.domain is correct [and different] for both.

RSL

then it’s most likely iptables.

Yes. Thanks for the help.

This one had me stumped for a while too but I have found if you modify
Webrick config.rb and change the entry :DoNotReverseLookup => ‘nil,’ to
‘true,’ your non-local host will be able to connect with the Webrick
server.

You can find the config.rb file for Rails 1.9.1 and 1.9.2 in this
directory …/usr/lib/ruby/1.9.1/webrick/config.rb

Thanks Russell

stan.baptista wrote in post #195212:

Did you open that port (5432) under iptables?

Don’t know for sure but I’ll check. I’m primarily a Windows developer,
just starting to move initial development over to Linux. The sys admin
gave me the port #.

Then the sysadmin needs a cluebat to the head. 5432 is the standard
port for PostgreSQL and probably shouldn’t be used for other purposes…

(I’m in-between systems at the moment which is why I wanted to view the
app from my Windows system.)

btw, SHOULD the script work?

I’m not sure if you need the -b.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone