Remotely viewing web pages served by pow.cx

前端 未结 3 1800
再見小時候
再見小時候 2020-12-28 20:57

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 somet

相关标签:
3条回答
  • 2020-12-28 21:14

    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.

    0 讨论(0)
  • 2020-12-28 21:14

    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.

    0 讨论(0)
  • 2020-12-28 21:22

    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.

    0 讨论(0)
提交回复
热议问题