Accessing Home Served Blog From iOS Devices

Some time back, I set up my Raspberry Pi as WordPress server.  I found that in order to view and edit my blog from within my own network, I had to update the host files on all of my desktop computers, so that they would know where to look when seeing the URL ...  This isn't too hard for windows, but for iOS devices (iPhone, iPad, etc.), there is no user-accessible hosts file for you to edit.

The answer to this problem is setting up a proxy server through which your iOS device can access the web.  I tried using the R. Pi to do this, but it proved too much for it to handle.  My next option was setting up a proxy on my older Linux desktop computer.  I did this with

sudo apt-get install squid

and it was up and running out of the box, no additional configuration necessary.  At this point, I just navigate to Settings --> WiFi --> [Current connection network name] --> information --> HTTP proxy

and then put in the Server and Port of the proxy.  No problem!  But what if the proxy server isn't turned on?  Well, then I can't browse the web through my iPhone without loosing the settings, which is annoying.  The next option?  An automatic HTTP proxy!  This is in the same location as the manual configuration on the iPhone.  This way, I can still browse the web, even if the computer with the proxy server is turned off, I can still browse the web.  To do this, you need the following:

  1. A functioning web server (I used nginx), configured properly.  This was the most time consuming part, since I needed a refresher in setting up nginx.  Thiswas a very helpful link.
  2. Create a proxy.pac file in the root directory of the web server.
  3. Put the proxy file in the iOS automatic HTTP proxy setting: e.g. http://192.168.1.107/proxy.pac

Here is the syntax for mine:

function FindProxyForURL(url, host) {
if ( localHostOrDomainIs(host, "lukesnow.no-ip.biz") ) {
return "PROXY 192.168.1.107:3128";
} else {
return "DIRECT";
}
}

This configures the iPhone/iPad so that it will use a proxy for accessing the blog that is within the LAN, and no proxy for all other traffic.

Now it works great!

UPDATE: unfortunately, the iPhone's auto proxy feature won't work once the proxy server is turned off!  It still has to be deleted for Internet to work, and then re-entered when you want to use the proxy server again.

Comments !