Wednesday, April 2, 2008

The Mostly Working iPhone/iTouch Thingy

So here's the deal. Squirm is dumb and does not like being run from a squid that is run as root. Well it also turns out that squirm also does not like being run by a squid that is run as proxy (what it wants it to be run as). So then some searching into why results in a new discovery called jesred. It does what squirm because it is build with squirm as a basis, but it does it better and faster and with more features (that I will probably never use). Anyway, jesred comes as a standard Ubuntu package and is thus installed easier (no more compiling and configuring, though that was not hard at all). Another thing jesred seems to do good is work. Within minutes of installing and configuring it to work with squid, YouTube magically worked.

Now onto the hard part of it. I had to get Apache and squid working together nicely. After looking through various ways to accomplish this I found the Apache RemoteProxy directive. It takes a given URL and if a request matches it, it will send the request to another proxy. In this case RemoteProxy * http://localhost:3128 is used to send all requests to squid running on the same machine on port 3128. This is the setup I have decided on, and I think it works.

The trial and error in between was trial and error of the various methods and tweaks of the one that I have eventually settled with. After many of the tweaks and restarts of the server I eventually found that the "YouTube not available" error was not due to improper configuration but extra URL variables such as the "&rel=1" in "http://iphone-wu.apple.com/feeds/videos/VnzXTGn3i58&rel=1". Without these extra variables YouTube works fine. I just need to rework the regex to take out all the extras from the end.

No comments: