Remotely viewing web pages served by pow.cx
Asked Answered
S

3

13

Using WEBrick you could navigate to an app you were serving from another device/virtual machine by navigating to your.ip.address.here:port

Is it possible to do something similar with pow.cx?

Schuss answered 16/6, 2011 at 22:42 Comment(0)
A
-1

Specifically, no, because Pow uses the Host header of the request to determine which app you need to access. To get that working remotely, you would have to have the remote machine map the required domain name to your IP address - either with a local DNS server or by editing the HOSTS file. Both of which are possible but annoying.

The simplest thing to do in that case is to start up a standalone Rails server as you mentioned (using ./script/server or rails s depending on the version), and then you can address http://[ip address]:3000 as before.

In other words, Pow works because it intercepts your local domain resolution, something that isn't affected by (or available to) remote machines.

Aculeate answered 16/6, 2011 at 23:4 Comment(1)
This was probably the best answer at the time it was posted (early 2011) but now (mid 2012) it looks like xip.io is the easiest way to go.Ornithosis
S
43

The latest version of Pow (0.4.0) now includes xip.io support. You can read about the release here.

Here's a quick explanation of how this helps Pow serve your Rails apps across your entire local network, from their post:

Say your development computer’s LAN IP address is 10.0.0.1. With the new version of Pow, you can now access your app at http://myapp.10.0.0.1.xip.io/. And xip.io supports wildcard DNS, so any and all subdomains of 10.0.0.1.xip.io resolve too.

Here's a description of xip.io, from their site:

xip.io runs a custom DNS server on the public Internet. When your computer looks up a xip.io domain, the xip.io DNS server extracts the IP address from the domain and sends it back in the response.

Saleratus answered 13/6, 2012 at 2:8 Comment(0)
D
12

There are basically two options:

  • Don't use pow: run your applications on localhost as usual and access them as usual
  • Edit the hosts file (or local DNS) to point your server machine ip

Example accessing from a virtual windows machine: Suppose you are running two rails applications in pow: store.dev and auth.dev, and you want to access them from a windows xp virtual machine to test them with IE, you only need to edit your hosts file to add the lines:

C:\WINDOWS\system32\drivers\etc\hosts

# Allow to access applications in pow. 
# The ip address points to the host machine localhost, that usually is the default gateway
10.0.2.2      store.dev
10.0.2.2      auth.dev

And then open the IE browser to access your applications in http://store.dev and http://auth.dev respectivelly.

Deutschland answered 17/6, 2011 at 17:13 Comment(2)
Hmm, this didn't work for me, even after a restart. I'm using Windows 7, though, so that might be the issue.Ornithosis
Inside the IE VirtualBox, I added 10.0.2.2 powapp.dev to the hosts file and it worked. Also, pow expects your project to have a public/ directory. That tripped me up for a while too. My particular project doesn't, so I just created a folder and symlinked my project into it as public/ then symlink that folder into pow.Bossism
A
-1

Specifically, no, because Pow uses the Host header of the request to determine which app you need to access. To get that working remotely, you would have to have the remote machine map the required domain name to your IP address - either with a local DNS server or by editing the HOSTS file. Both of which are possible but annoying.

The simplest thing to do in that case is to start up a standalone Rails server as you mentioned (using ./script/server or rails s depending on the version), and then you can address http://[ip address]:3000 as before.

In other words, Pow works because it intercepts your local domain resolution, something that isn't affected by (or available to) remote machines.

Aculeate answered 16/6, 2011 at 23:4 Comment(1)
This was probably the best answer at the time it was posted (early 2011) but now (mid 2012) it looks like xip.io is the easiest way to go.Ornithosis

© 2022 - 2024 — McMap. All rights reserved.