/ troubleshooting

SSR Global Mode Not Working with Chrome

The Story

I was configuring nintendo switch to use the SSR Proxy I bought recently. Such a simple task caused me 2 hours.. Life is hard.

The Problem

When using ShadowsocksX-NG-R8, you might encounter this problem:

  • Under Global / WhiteList Mode, your Chrome can't visit any site,
    • But Safari works perfectly fine;
    • Chrome seems can only work uner PAC mode;
  • And Chrome is in the latest version.
    • And you're sure there's no other Chrome extensions about proxy is enabled;

The Solution

Recommended:

  1. Uncheck "Follow Global Mode" in HTTP Proxy Preference
  2. Switch to anyother mode then switch back to global mode

WX20200329-134420@2x

OR

  • Modify SSR's HTTP Proxy Listen Address to '127.0.0.1' or 'localhost'

OR

  • Modify the System Web Proxy Server to match your outbound IP
    • But it will be overwritten back to default when switching mode

77840654-442fe000-71bc-11ea-82a5-05a6a14a3151

The Reason

HTTP Proxy Listening on IP Can't Accept Localhost Requests

assume your local IP is 192.168.1.2

According to System settings, Chrome believes HTTP Proxy is listening on 127.0.0.1, so it tries to relay all the requests to 127.0.0.1:1087

But your HTTP Proxy is actually listening on 192.168.1.2:1087, it's a different interface than localhost/127.0.0.1, so it can't accept request made to localhost/127.0.0.1

That's why Chrome can't use the SS server and was completely blocked under Global mode.

Chrome and Safari

Probably because Chrome and Safari use different priority orders while looking for available system proxies

Safari looks for Socks Proxy first while Chrome looks for HTTP Proxy settings, once Chrome found HTTP Proxy settings is available it won't try socks proxy.

Root Cause

The problem might be in ShadowsocksX-NG, I guess it uses the default http listen address '127.0.0.1' rather than the user-filled value when switch to global mod (and when enabled 'FollowGlobal')

I've also open an issue to help people out there.

Code Proof

ShadowsocksX-NG/ShadowsocksX-NG/ProxyConfHelper.m, L155-L176

(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];
}
SSR Global Mode Not Working with Chrome
Share this