I have a local Apache setup with several virtual hosts:

  • mywebsite.localhost
  • images.mywebsite.localhost
  • etc.

I'd like to make these available on my local network, to test my website on mobile devices. Other questions on Stack led me to the proxy solution, where I will use my computer's IP address as a proxy on the iPhone/iPad.

I want the proxy to:

  • Process any request as if it was originated from my computer (including *.localhost names)
  • Deny requests from IP addresses not in the 192.168.* range

I've enabled mod_proxy:

LoadModule mime_module modules/mod_mime.so
LoadModule proxy_http_module modules/mod_proxy_http.so

I've (hopefully) secured it:

<Proxy *>
Order Deny,Allow
Deny from all
Allow from 192.168

Now I'm struggling to answer these questions:

  • Will the proxy run on port 80 as well, or should it run on another port?
  • How do I configure the proxy to forward all requests as stated above?
  • I'm not understanding why you're using mod_proxy. It's typically used for two cases: 1) access control to another server you don't want people to reach directly and 2) to forward requests from a subdirectory of your server to another server. Both are done by configuring apache to forward certain requests to another server. If you only have one server and it's already accessible on the network, this isn't going to do much for you. What exactly is the problem you're trying to solve? – DerfK Mar 23 '13 at 18:49
  • @DerfK: I might be using the wrong tool, but my problem is that I can't access my website from just the IP address of my computer. I'm hosting several virtual hosts locally, which means that the other computers must be able to resolve mywebsite.localhost to my computer's IP address. I could use a custom DNS server for this, but I think it would be more complicated on my Windows machine than using the existing Apache installation to act as a proxy for the iOS devices. – Benjamin Mar 23 '13 at 19:02

I found the solution, I just needed to add the following line to the aforementioned config:

ProxyRequests On

I used my computer's IP address and port 80 as proxy configuration on my iPad, and now this one can access mywebsite.localhost and any internet website, just like my computer.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.