简体   繁体   English

如何使用公司代理为iOS模拟器设置Charles代理

[英]How to set up Charles proxy for iOS simulator with corporate proxy

We are developing iOS apps with charles, but recently company used automatic proxy configuration like this 我们正在使用Charles来开发iOS应用,但最近该公司使用了这样的自动代理配置

http://ourproxy.com:8181 http://ourproxy.com:8181

Everyone need set up this from connection configuration. 每个人都需要从连接配置中进行设置。 That way will make Charles failed to read http connections. 这样会使Charles读取HTTP连接失败。

So how to set up Charles proxy to make it work to monitor simulator apps running ? 那么,如何设置Charles代理以使其能够监视模拟器应用程序的运行?

Maybe you need a copy of your company's pac file, just add a condition of your simulator app requested domain. 也许您需要公司的pac文件的副本,只需添加模拟器应用程序请求的域的条件即可。 For example, create new pac file: 例如,创建新的pac文件:

function FindProxyForURL(url, host) {
    if (isPlainHostName(host)
    || dnsDomainIs(host, "simulator_requested_domain.com")
    || false) {
        return "PROXY 127.0.0.1:8888";   // proxy to Charles port.
    } else {
        // you may need to copy your company's conditions
        return "PROXY your_company_proxy.com:8181";
    }
}

And then, upload this file to your local or remote http server, and set network's automatic proxy configuration to the url of this pac file. 然后,将此文件上传到本地或远程http服务器,并将网络的自动代理配置设置为该pac文件的url。

Because of macosx's sandbox policy, browsers or other APPs cannot access local pac files, so you need to put pac to a "http://" based path. 由于macosx的沙盒策略,浏览器或其他APP无法访问本地pac文件,因此您需要将pac放入基于“ http://”的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM