How to use SOCKS proxy in an iOS device

Posted by Mohammad Mahdi Ramezanpour on Comments (15)

As you may know, I’m one of the Apple’s fans and love to use my iOS gadgets (iPhone and iPad) in every type of tasks. Many of iOS users are using their iPhones/iPads in enterprise environments and want to connect to their company’s network while at work. In some cases, network administrators set a proxy server so users must connect to that proxy in order to access internal websites and more. As you know, iOS is currently supports HTTP proxy but it’s not enough for many users because their company’s network administrators set SOCKS proxy instead of HTTP!

By the time, there are some applications that can be installed in order to use SOCKS proxy in an iOS device but these apps are only available for jailbroken devices so other users can’t install them!

In this post I want to tell you how to use SOCKS proxy in an unjailbroken iOS device.

Note: In this example I’m using an iPhone to demonstrate the steps but you can use any iOS device; there’s no limitation at all!

The first thing you need is a web server (or any computer which has access to the internet). In this example my webserver is a PC with Windows 7 ultimate installed but you can use any type of web server you want. We use this web server in order to upload a .pac file!

The .pac file

A proxy auto-config (PAC) file defines how web browsers and other user agents can automatically choose the appropriate proxy server (access method) for fetching a given URL.

A PAC file contains a JavaScript function "FindProxyForURL(url, host)". This function returns a string with one or more access method specifications. These specifications cause the user agent to use a particular proxy server or to connect directly.

For more information about PAC files Click Here

Now you need to create a PAC file like the following:

function FindProxyForURL(url, host)
{
  return "SOCKS 192.168.0.1:3128";
}

After you’ve created the PAC file, upload it to your webserver.

Finally, you have to configure your iOS device. In the Setting app, tap on the Wi-Fi and then tap on the arrow in the right side of your selected access point:

WI-FI Networks

Then set HTTP proxy to “Auto” and then enter the URL of the PAC file you’ve uploaded to the webserver in the URL text box.

WI-FI Network Setttings

You’re done! Now you can access to your SOCKS proxy server!

If you have any question about this post, please leave your comments down below and I’ll answer them as soon as possible.

Hope it helps.

Comments (15) -

Roy
Roy said:
I've done what you've done, but for some reason it's not working? The .pac is uploaded and I've tested to see if I can view it on Safari, it's entered correctly in the URL section under HTTP Proxy, the IP Address is DHCP if that's of any use.. I'm not sure what I'm doing wrong. :/

Roy
Roy said:
One more thing, I'm using;

function FindProxyForURL(url, host) {
  return "SOCKS localhost:42280";
}

and I've tried 127.0.0.1:42280 too but no luck.. Frown

Admin
Admin said:
@Roy:
This sample may not work for some reasons.
The problem can be of your web server! Many of web servers such as IIS, deny .pac files by default. So you have to add .pac files to trusted extensions.
For more information about setting .pac files in IIS, you can use the following link:
marckean.wordpress.com/.../

Roy
Roy said:
I got it working, but the proxy only seems to work with Safari and the App Store, when I try to open some apps they close instantly and/or don't work correctly after logging in. Frown

Admin
Admin said:
@Roy:

Me and most of my colleagues are using this and we don't have any problem at all.

I believe you're doing it wrong or there's a problem.

Ali
Ali said:
How we can add user and pass ?
And can use the Internet share file server?

Admin
Admin said:
@Ali:
It's not common to use username and password along with .pac files but here you go:

The pattern for creating the PAC file with username and password is this:
return "SOCKS [username]:[password]@[proxy]:[port]"
All you need to do is to replace [username], [password], [proxy] and [port] parameters with yours.

Admin
Admin said:
@Ali:
There's no limitations at all. You can use this in any server. But the server must be connected to the internet.

Admin
Admin said:
@Ali:
There are lots of apps you can use such as iProxy. But I think this is the best way to access the proxy server.

Ali
Ali said:
I rather to use this way
But I got a socks account from a seller company that sell socks and https proxy for use in proxifier on win
And I used as the same you told

But it don't work!
I really need it,
If I would have had a guide with more detail I could use it
I really need it,

Admin
Admin said:
Life is more complicated than you think Wink Maybe I should optimize my blog more than before. I'll be working on this issue to solve it as soon as possible.

Admin
Admin said:
@Ali:
i just realized that @ is not working in the proxy server settings when want to associate authenticated information to it.

I'm currently working on it to find a way. I'll post consequences as a comment here as soon as I found anything.

Credit Card
Credit Card said:
You are right on the mark. I love your blogs; very funny; like the philosophy.

Vh
Vh said:
Hello,i'm iranian .it seems that you're iranian too because of MTN irancell!
so i didn' t under stand the text exactly. So can you help me with the farsi version of your text
By sending it to my email or post it to your site. I will thank you if you help me
Thanks

mohammad
mohammad said:
salam,khaste nabashin.bebakhshin man engelisim dar on had khob nist ke betonam matne balaro tarjome konam.hamontor ke dostemon goftan shoma be nazar ke na sad dar sad irani hastin,age zahmati baraton nadare ye lotfi bokonin tarighe sakhte pac baraye man besorate farsi mail konin ye donya mamnon misham azaton.mr30 babate post aaaliton.

Add comment

biuquote
  • Comment
  • Preview
Loading