Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global/WhiteList Mode Not Working in Chrome but Working in Safari [Root Cause Found] #1291

Open
xhyumiracle opened this issue Mar 29, 2020 · 4 comments

Comments

@xhyumiracle
Copy link

Describe the bug
Under some circumstances (re-config HTTP Proxy), switching to Global/WhiteList mode causes Chrome unable to visit any site while safari works perfectly fine. Chrome can only work in PAC mode in this situation.

To Reproduce

  1. Open "HTTP Proxy Preference", Modify "HTTP Proxy Listen Address" to your outbound IP, and make sure "Follow Global Mode" is checked.
  2. Switch to any other mode then switch back to Global/WhiteList.
  3. Try to visit any website with Chrome, probably not working (But safari is still cool and calm)

Expected behavior
Chrome works in this situation.

System and Shadowsocksx-NG version: (please complete the following information):

  • OS Version: 10.14.6
  • Version 1.4.3-R8
  • Chrome Version: 80.0.3987.149

Root Cause
I Guess its because it uses the default http listen address '127.0.0.1' rather than the user-filled value when switch to global (and when enabled 'Follow Global')
Maybe here L165 (just searching around, didn't dive into it)

+ (void)enableGlobalProxy {
NSString* socks5ListenAddress = [[NSUserDefaults standardUserDefaults]stringForKey:@"LocalSocks5.ListenAddress"];
NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"];
NSMutableArray* args = [@[@"--mode", @"global", @"--port"
, [NSString stringWithFormat:@"%lu", (unsigned long)port],@"--socks-listen-address",socks5ListenAddress]mutableCopy];
// Known issue #106 https://github.com/shadowsocks/ShadowsocksX-NG/issues/106
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTPOn"] && [[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTP.FollowGlobal"]) {
NSUInteger privoxyPort = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalHTTP.ListenPort"];
NSString* privoxyListenAddress = [[NSUserDefaults standardUserDefaults]stringForKey:@"LocalHTTP.ListenAddress"];
[args addObject:@"--privoxy-port"];
[args addObject:[NSString stringWithFormat:@"%lu", (unsigned long)privoxyPort]];
[args addObject:@"--privoxy-listen-address"];
[args addObject:privoxyListenAddress];
}
[self addArguments4ManualSpecifyNetworkServices:args];
[self addArguments4ManualSpecifyProxyExceptions:args];
[self callHelper:args];
[self stopPACServer];
}

@xhyumiracle
Copy link
Author

Workaround:
Uncheck "Follow Global Mode", then switch back to global
or Modify the System Web Proxy Server to match your outbound IP: (will be overwritten to default when switching mode)
image

(Probably because Chrome and Safari use different priority order when looking for available system proxies)

@xhyumiracle
Copy link
Author

Though different reasons, same behaviors with #743

@fan-bruce
Copy link

端口占用会导致链接不上么

@Dinlan
Copy link

Dinlan commented Sep 6, 2020

解决方法:
取消选中“遵循全局模式”,然后切换回全局
或修改系统Web代理服务器以匹配您的出站IP :(切换模式时将覆盖为默认值)
图片

(可能是因为Chrome和Safari在查找可用的系统代理时使用不同的优先级顺序)

It's so good to resolve my trouble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants