Bug 233943 - NSURLSession WebSocket does not use the configured proxy
Summary: NSURLSession WebSocket does not use the configured proxy
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL: https://ws.ifelse.io/.ws
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-07 11:41 PST by Andrea Govoni
Modified: 2021-12-09 10:13 PST (History)
5 users (show)

See Also:


Attachments
WebSocket connection timeout errors in the JavaScript Console. (344.02 KB, image/png)
2021-12-07 11:41 PST, Andrea Govoni
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Govoni 2021-12-07 11:41:38 PST
Created attachment 446214 [details]
WebSocket connection timeout errors in the JavaScript Console.

– Overview:
On macOS Monterey systems with configured Automatic Proxy Configuration (.pac) file or HTTP/HTTPS proxy servers, Safari doesn't use the proxy when establishing WebSocket connections if the experimental feature "NSURLSession WebSocket" is enabled (that is the default setting on Monterey).

– Steps to Reproduce:
1) Set a PAC file or HTTP/HTTPS proxy in System Preferences --> Network.
2) Go to https://ws.ifelse.io/.ws (that server is running https://github.com/jmalloc/echo-server according to this Stack Overflow question https://stackoverflow.com/questions/4092591/websocket-live-server).

– Actual Results:
On networks where Internet access is allowed only using the network proxy, the connection will not succeed and JavaScript Console will yield:
WebSocket connection to 'wss://ws.ifelse.io/' failed: The request timed out.

– Expected Results:
Safari should use the system proxy.

– Build Date & Hardware:
I've tested this issue on macOS Monterey 12.0.1 (21A559) with the following Safari builds:
• Safari 15.1 (17612.2.9.1.20) <-- current version on Monterey
• Safari Technology Preview release 135 (Safari 15.4, WebKit 17613.1.7.3)
• WebKit build archive r286598 <-- it actually threw a bunch of errors on startup and I was unable to test by disabling "NSURLSession WebSocket" because when I tried to open its Preferences to enable the Development menu, it crashed… so I'm not 100% sure about this test

– Additional Information:
If I disable the "NSURLSession WebSocket" experimental feature, system proxy is used and connections succeed.
Comment 1 Alex Christensen 2021-12-07 12:09:07 PST
Thank you for the report.  We are tracking this internally as rdar://84740185
Comment 2 Alexey Proskuryakov 2021-12-09 10:13:15 PST
Marking as MOVED per the above, as the fix will be below WebKit.