简体   繁体   中英

ios simulator proxy settings not working

TL;DR;
Safari mac OSX browser reaches address fine, iOS simulator gets 407'ed

Long Version
Guys, there's something very wrong here... around the internet i keep reading that the iOS simulator will use the mac OSX proxy settings, but i keep getting a 407 trying to perform my "get" in the simulator, but not from my browser... Whats up with that? am I missing a configuration or something?

In order to better understand the problem i created a app with only a web view and had it go to various know-to-work addresses... none worked... 407'ed all...

I have the same problem.
The ios simulator of iOS6 could connect successfully through the proxy authentication, but from iOS7, it could not connect through the proxy and ios simulator gets 407 status code.

I also checked the log of the proxy server. A request of user and password for the proxy authentication from ios simulator did not have reached to the proxy server.

So, we deal with this issue by running a local proxy server that is written by ruby like this.

 #!/usr/bin/env ruby
 require 'webrick'
 require 'webrick/httpproxy'
 require 'uri'

 handler = Proc.new() do |req, res|
   # do something
 end

 proxy = WEBrick::HTTPProxyServer.new(
   BindAddress: '0.0.0.0',
   Port: 8080,
   ProxyURI: URI.parse(ENV['http_proxy']),
   ProxyContentHandler: handler)

 Signal.trap('INT') do
   proxy.shutdown
   # it did not shutdown for some reason, so kill the process
   sleep 5
   Process.kill('KILL', $$)
 end

 proxy.start

Before running the proxy server, we set up http_proxy .

However, this method is not a solution essential, so I hope that Apple can resolve this problem immediately.

由于主机和模拟运行时之间的距离增加(在这种情况下特别是钥匙串),因此无法使用需要通过7.0版或更高版本的iOS Simulator进行身份验证的代理服务器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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