Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running some webcams (with embedded servers) on my business network that are accessible via the web, and I want to make "pretty" URLs that Apache can route to the ports that they run on so my wife doesn't need to memorize the port numbers.

For example, one of the cameras is local IP 192.168.0.200, and the webcam server (I'm using IP Webcam on an Android phone) is running on port 7890. I port forwarded my router and I can access it via the web at mydomain.com:7890. What I want to do is give it a nice URL like mydomain.com/cam/1 and have Apache route to the correct LAN IP/port. This also works fine with the following in my httpd.conf:

ProxyPass /cams/1 http://192.168.0.200:7890
ProxyPassReverse /cams/1 http://192.168.0.200:7890

I can type mydomain.com/cam/1 into the browser and get the html page that it serves.

The problem is, the page it initially serves is just a bunch of links, i.e., the following:

enter image description here

where each link is relative to the root of the page. For example, I usually use the 3rd link, "Use java browser plugin". The URL for this link is /java.html. If I use the "absolute" URL, mydomain.com:7890/java.html, it works as expected. But with the Proxying enabled, the link produced is mydomin.com/java.html, and I have no java.html in my root folder (even if I did, it would be a different file than the webcam's).

So my question is, how to I continue to have these pretty URLs, but then have the URLs internal to the served page (or any arbitrary sub-URLs) still respect the /cams/1 offset so that it will all work right?

share|improve this question

closed as off topic by Shane Madden, EEAA, Ward, Iain Aug 28 '12 at 6:54

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

The HTML for the page you're looking at is generated by the webcam server, not by Apache. That's where you need to fix the configuration.

share|improve this answer
    
You could also use a more sophisticated proxy that can rewrite the HTML that's passing through it, but this would be substantial overkill for what you're trying to do -- If you can't modify the HTML generated by the camera you're pretty much out of luck... –  voretaq7 Aug 28 '12 at 17:24

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