Tuesday, November 6, 2007

Setting up proxy in Apple IPhone

Nowadays many Mobile Service Providers requires proxy support to be enabled and configured to allow GPRS internet via their network,

Since Apple IPhone hasn't been officially released in many countries and because of bonding with AT&T they haven't provided an option in their user interface to enable and setup proxy.

Here i am going to outline the steps required to enable and setup proxy in Apple IPhone


1) Turn off Auto-Lock Go to ‘Settings’ -> ‘General’ -> ‘Auto-Lock’ and select ‘Never.’ You can turn it back on after you’re done with this, but for now disable it.

2) Enter APN, username and password Go to ‘Settings’ -> ‘General’ -> ‘Network’ -> ‘Edge.’ For the APN field enter wap.voicestream.com. Make sure the username and password fields are empty.

3) Create proxy.pac Open your favorite text editor, and paste in the following code into a new document:

function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "10.0.0.0", "255.0.0.0"))
return "PROXY 216.155.165.50:8080";
else
return "DIRECT";
}

Save the file to your Desktop as proxy.pac.

The text file should be in UTF-8 Text Encoding Format.

Upload proxy.pac to the iPhone Now we need to copy proxy.pac to our iPhone’s /private/var/root/ directory using iBrickr or iFuntastic

Update preferences.plist located at /private/var/root/Library/Preferences/SystemConfiguration/preferences.plist on your iPhone.
look for the area of the file where it has the lines:

<key>DeviceName</key>
<string>ip1<string></string></string>


Note that the text inside the string tags should be ip1 (as opposed to en0, ip2 or anything else). Now add the following chunk of xml (in blue) to the file in the appropriate place.

<key>Interface</key>
<dict>
<key>DeviceName</key>
<string>ip1</string>
<key>Hardware</key>
<string>com.apple.CommCenter</string>
<key>Type</key>
<string>com.apple.CommCenter</string>
</dict>
<key>Proxies</key>
<dict>
<key>ProxyAutoConfigEnable</key>
<integer>1</integer>
<key>ProxyAutoConfigURLString</key>
<string>file:///private/var/root/proxy.pac</string>
</dict>

<key>com.apple.CommCenter</key>
<dict>
<key>AllowNetworkAccess</key>
<integer>1</integer>
<key>Available</key>
<integer>1</integer>
<key>Setup</key> </dict>

By adding this code to the file, you’re instructing your iPhone to use a proxy

Phew you are done, restart your phone and fire up Safari.....

4 comments:

Unknown said...

Nice!

I was wondering, is the proxy setting in preferences.plist system-wide, or is it only used by Safari?

i.e. do you know if traffic from other apps like youtube,googlemaps,etc will go through the proxy or not?

Unknown said...

Nice funciton...
works great in Germany with vodafone Internet Flat with Iphone 1.4..

Does this works with 2.0.1???

Onno said...

Hello Raghu,

thanks for the explanation.
But like Ulrich said: does it work on version 2 (now 2.1) and on the 3G iPhone?
And how do I enter name and password for a proxy?

火鸟 said...

It's not working in IPhone 4. those setting was removed



Mini Spin Columns