iphone - Programmatically set (System-wide) proxy settings?

13,284

If you're configuring iPhones in a commercial environment, you should look at the Enterprise Deployment Guide. Specifically, you should look at using the iPhone Configuration Utility to create a *.mobileconfig configuration file that can be distributed to all the phones in your network. The *.mobileconfig plist supports changing the following proxy configuration settings on the phone:

PropNetProxiesHTTPEnable (Integer, 1 = Proxy enabled)
PropNetProxiesHTTPProxy (String, Proxy server address)
PropNetProxiesHTTPPort (Integer, Proxy port number)
HTTPProxyUsername (String, optional username)
HTTPProxyPassword (String, optional password)
PropNetProxiesProxyAutoConfigEnable (Integer, 1 = Auto proxy enabled)
PropNetProxiesProxyAutoConfigURLString (String, URL that points to a PAC file where the configuration information is stored)

The iPhone Configuration Utility does not currently support adding or editing those settings, so you may need to get your hands dirty with the Property List Editor application. Also, it looks like the latest version of the Enterprise Deployment Guide does not include the settings I've included above, but you should be able to find it in the previous version of the document.

Share:
13,284
Andrew Ensley
Author by

Andrew Ensley

With continuous experience beginning in 2004, I am a seasoned software developer, system administrator, database administrator, DevOps engineer, and team leader. My favorite areas of focus in development are performance, optimization, and security. I have experience with: Git, Java, C#, Python, TypeScript, Node.js, React.js, SQL, PHP, Linux, Windows, MacOS, Infrastructure-as-Code, Configuration-as-Code Azure, ADO, Jenkins, GitHub, Nexus RM/IQ, JFrog Artifactory, SonarQube, Docker, Kubernetes, Cloud Foundry, TAS, TKGi, DigitalOcean, Ansible, AWS Visual Studio Code, IntelliJ IDEA, Eclipse, PyCharm, Android Studio I love automation and open-source software.

Updated on June 22, 2022

Comments

  • Andrew Ensley
    Andrew Ensley almost 2 years

    I am new to iPhone development, so I'm sorry if this is a stupid question. I am developing an application whose purpose will be to route all iPhone activity through my company's proxy.

    Is there a way to programmatically set system-wide proxy settings in the iPhone (which will also take effect on the 3G connection)?

    I know there is a way to manually set proxy settings for each wifi connection. Detecting new networks and setting the proxy on them would be acceptable. However, I need to also be able to set the proxy on the 3G connection.

    Also, bonus: Is there a way to programmatically change the "Restrictions" settings?

    If anyone has any tips or can point me in the right direction, I would appreciate it. Thanks.

    EDIT: Please understand that this is for a legitimate purpose. Apple has to approve app store additions, so it's not like I'm trying to spread a virus. Please, constructive answers only.

  • Andrew Ensley
    Andrew Ensley about 15 years
    Wouldn't that mean that every iPhone I want to install it on will have be jail-broken? Forgive me if it's a noob question. I've learned everything I know about the iPhone in the past few days.
  • Andrew Ensley
    Andrew Ensley almost 15 years
    That looks really promising. I'm going to check it out. Thanks!
  • Andrew Ensley
    Andrew Ensley almost 15 years
    Ok. I've read through most of that manual and tried out the iPhone Configuration Utility. The only place I see for Proxy settings is under Access Point settings, which means I can setup the proxy for any wifi networks I add in there, but I want system-wide proxy - applying to all wifi connections and the 3G connection. I didn't see a place for the settings you listed either. What am I missing? Is there a full documentation somewhere about all of the options available in the .mobileconfig file and detailing its format?
  • Nathan de Vries
    Nathan de Vries almost 15 years
    My answer has been updated to incorporate some of your concerns.
  • Andrew Ensley
    Andrew Ensley almost 15 years
    Great. I still can't be sure if this works the way I want it to, but I'll let you know.
  • Andrew Ensley
    Andrew Ensley almost 15 years
    Ok. I've added proxy settings as per the previous version of the Enterprise Deployment Guide, but they're not working. The profile installs just fine, but the proxy isn't there. It's possible my .mobileconfig file isn't properly formatted, but it seems to be correct. The documentation was pretty vague about where the settings went. I can post my .mobileconfig file if you want to look at it.
  • Andrew Ensley
    Andrew Ensley almost 15 years
    Thank you very much for your help!