Proxy web browser for XHTML Strict and non port-80 hosts
July 26th, 2010 | by Sean |While I’m developing projects I run a webserver on my own PC on a high-numbered port such as 22795. I use a little local proxy that I wrote myself for mapping entries in /etc/hosts back to localhost, and the proxy maps the request onto the web service running on the appropriate port. I typically run more than one web service at once, so I might have test.example.com and api.example.com mapped to localhost in /etc/hosts and run two webservers serving test.example.com on port 22795 and api.example.com on port 22796. The local proxy service is run as root and listens on localhost port 80. When it receives a request for ‘test.example.com’ it opens port 22795 and pipes input and output forth and back. All well and good.
I occasionally connect to the coffee-shop AP across the street to check code that uses the client IP address. I don’t expose port 80 on my development PC through port-mapping on my ADSL router, I just map the high-numbered port for the specific service I want to test. I use an URL like “http://123.456.789.321:22795/” to test access from the coffee-shop’s network, and that works a treat too – although I have to remember to turn off Host: header field checking or set it to allow the WAN IP + port combination.
Today I hit a snag. I wanted to test a service that does IP address to country mapping. I downloaded an IP range to Country Code database from ZaiGadgets.com and added it into a project. It worked a treat from a PC (another PC – my workstation has to stay connected to my own router to provide the service!) connected to the coffee-shop’s AP. But of course, both APs are located in Malaysia, so it’s not much of a test. So I used a Web Proxy Browser I habitually use as a first attempt at debugging HTTP problems at an Italian university – it didn’t work, claimed to be unable to connect.
I searched for “proxy browser” and must have tried 10-20 before I found one that did actually work. Many had problems connecting, some explicitly complained about the URL (remember I’m using IPĀ address + port). Many just seemed lame. I’ve been using XHTML Strict in my recent projects, and many proxy browsers don’t seem to be able to cope properly with XHTML source pages, producing bad XHTML output that my browser quite reasonably refuses to render. Since it took me a while to find it, here it is:
I should probably mention that Browser Unblocker claims to use a proprietary web proxy written in PHP called ‘glype’, just in case you’re looking for the software rather than the service.