blob: 5f48e01330f2d65d3208addf1431a568939b8882 [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Proxy Auto Config Using WPAD
andybons3322f762015-08-24 21:37:092
andybonsad92aa32015-08-31 02:27:443Most systems support manually configuring a proxy for web access, but this is
Quinten Yearsley317532d2021-10-20 17:10:314cumbersome and kind of technical, so Chrome also supports
andybonsad92aa32015-08-31 02:27:445[WPAD](http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol) for proxy
6configuration (enabled if "automatically detect proxy settings" is enabled on
7Windows).
andybons3322f762015-08-24 21:37:098
andybonsad92aa32015-08-31 02:27:449## Problem
10
11Currently, WPAD is pretty slow when we're starting up Chrome - we have to query
12the local network for WPAD servers using DNS (and maybe NetBIOS), and we wait
13all the way until the resolver timeout before we try sending any HTTP requests
14if there's no WPAD server. This is a really crappy user experience, since the
qyearsleyc0dc6f42016-12-02 22:13:3915browser's basically unusable for a couple of seconds after startup if
andybonsad92aa32015-08-31 02:27:4416autoconfig is turned on and there's no WPAD server.
17
18## Solution
19
Steven Weid98e9ca2024-09-25 18:20:3320There are a couple of simplifying assumptions we make:
andybons3322f762015-08-24 21:37:0921
andybonsad92aa32015-08-31 02:27:4422* If there is a WPAD server, it is on the same network as us, and hence likely
23 to respond to lookups far more quickly than a random internet DNS server
24 would.
25* If we get a lookup success for WPAD, there's overwhelmingly likely to be a
26 live WPAD server. The WPAD script could also be large (!?) whereas the DNS
27 response is necessarily small.
andybons3322f762015-08-24 21:37:0928
andybonsad92aa32015-08-31 02:27:4429Therefore our proposed solution is that when we're trying to do WPAD resolution,
30we fail very fast if the WPAD server doesn't immediately respond to a lookup
31(like, 100ms or less). If there's no WPAD server, we'll time the lookup out in
32100ms and get ourselves out of the critical path much faster. We won't time out
33lookups for explicitly-configured WPAD servers (i.e., custom PAC script URLs) in
34this fashion; those will still use the normal DNS timeout.
andybons3322f762015-08-24 21:37:0935
andybonsad92aa32015-08-31 02:27:4436**This could have bad effects on networks with slow DNS or WPAD servers**, so we
37should be careful to allow users to turn this off, and we should keep statistics
38as to how often lookups succeed after the timeout.
andybons3322f762015-08-24 21:37:0939
andybonsad92aa32015-08-31 02:27:4440So here's what our WPAD lookup policy looks like **currently** in practice
41(assuming WPAD is enabled throughout):
andybons3322f762015-08-24 21:37:0942
andybonsad92aa32015-08-31 02:27:4443* If there's no WPAD server on the network, we try to do a lookup for WPAD,
44 time out after two seconds, and disable WPAD. Until this time, no requests
45 can proceed.
46* If there's a WPAD server and our lookup for it answers in under two seconds,
47 we use that WPAD server (fetch and execute its script) and proceed with
48 requests.
49* If there's a WPAD server and our lookup for it answers after two seconds, we
50 time out and do not use it (ever) until a network change triggers a WPAD
51 reconfiguration.
andybons3322f762015-08-24 21:37:0952
53Here's what the **proposed** lookup policy looks like in practice:
54
andybonsad92aa32015-08-31 02:27:4455* If there's no WPAD server on the network, we try to do a lookup for WPAD,
56 time out after 100ms, and disable WPAD.
57* If there's a WPAD server and our lookup for it answers in under 100ms or
58 it's explicitly configured (via a custom PAC URL), we use that WPAD server.
59* If there's a WPAD server and our lookup for it answers after 100ms, we time
60 out and do not use it until a network change.