问题
I am writing a .pac file for use with iOS5 without jailbreak, but I feel trouble in matching the url starting with "https" (eg: https://test.com).
Here is my script:
function FindProxyForURL(url, host) {
if (shExpMatch(url, "https://*")) return "PROXY 123.123.123.123";
return 'DIRECT';
}
And if I matched "https://test.com", how can I return "https://123.123.123.123" to the URL?
回答1:
This should not have been accepted. Please vote to delete if you can.
Original answer:
You cannot proxy the HTTPS protocol without breaking end-to-end security, which is its single distinguishing feature. The reason your matches "don't work" is that your PAC file is ignored for HTTPS.
Routing the traffic between the browser and an on-device proxy over HTTPS is also quite pointless, regardless of whether it is technically possible. I imagine it has been made impossible for security reasons (so that users cannot be fooled to think traffic is secure when it isn't) but I have not investigated.
回答2:
Use this:
if (shExpMatch(url, "https:**"))
This should fix it.
来源:https://stackoverflow.com/questions/9493978/https-in-pac-file