This document provides a comprehensive discussion of the manual proxy feature "No Proxy for:", including configuration issues, testing and bugs.
Mozilla users, mozilla developers, mozilla testers.
As browsers rapidly grew in popularity in the mid-90's, many network administrators added proxy servers. Initially, proxy servers were used for access control and performance. Many networks had limited access to the public network via proxy servers. Because the public network was small in scope and connections were slow, a caching proxy could often improve the overall performance.
This feature was originally designed as a "blacklist" of sites or domains that was within the intranet, and should not be accessed via the proxy server. Due to various limitations, this feature should be used for only the most simple blacklist scenarios. In almost all cases, PAC gives better control and flexibility.
"No proxy for" is an optional field, part of "Manual proxy configuration". The field is relatively short, but can hold reasonably long (2K+ characters) entries. New profiles contain the values "localhost, 127.0.0.1", by default.
- Preferences | Advanced | Proxies
- control-click menu for off line-online icon (network plug)
The no proxy list is composed of either domain elements or IPv4 address elements. The elements are separated by either a space (" ") or a comma (",").
Note for former-IE users: "*" is supported only at the beginning of domain filters (*.mozilla.org).
|To block ...||put this into "No Proxy for"||...for example use...||Limitations|
|a domain, including sub-domains||domain suffix, starting with a dot||".mozilla.org, mozilla.org"||You must use both entries to fully block a single domain.|
|a hostname (without domain)||hostname-only (see problems below)||"localhost"||Also blocks any possible domains that start with the entry ("www.otherdomain.localhost")|
|a hostname (with domain)||domain name||"www.mozilla.org"||Also blocks any hostnames or domains that end in the same string (other-www.mozilla.org)|
|an IP address||IP address||"126.96.36.199"||Does not block hostnames that resolve to the IP address ("127.0.0.1" does not block "localhost")|
|a Network||network w/ CIDR block||"10.0.0.0/8"||Does not block hostnames that resolve to the IP address range (10.0.0.0/8 is not "no proxy for intranet hostnames")|
|optional - port-specific||(optional) ":" + port number||"<FILTER>:81"||Only black-lists port. Only applies to one port (no support for ranges and/or multiple ports). Port-only filters ":80" or "*:80" are not supported.|
|all non-FQDN hosts, such as intranet hosts||The string "<local>" (without quotes)||"<local>"||Bypasses the proxy for all hostnames which have no periods in them. For example: "https://myCompanyIntranet/"|
|Formats that are not accepted||Example|
|Domain filters with interior wildcards||www.*.com|
|IP address string prefixes||127. or 10.0.*|
|IP addresses with wildcards in quads||10.*.*.*|
By default "localhost" and "127.0.0.1" are excluded, since most people assume these should connect to the local system.
Note: When IPv6 support is added, additional addresses will need to be added and tested.
Communicator used "
- No IPv6 support - The backend stores IPv4 addresses as IPv6, but IPv6 formats are not supported.
- Scalability - Not usable for local domains with numerous hostnames. Not usable for large number of filters (ad blocking).
- Mozilla implements this feature with significant limitations, users may find that writing a PAC file is more suitable for their needs.
The most important aspect of "no proxy for" is that it uses a right-sided string compare. This algorithm works in most cases, but is also the root cause of most broken functionality. In recent versions, more logic was added for IP addresses, but the legacy problems remain for domain names.
The main problem is rooted in the DNS syntax, which allows a hostname to exist at the node level of a domain name. In other words, for the domain "mozilla.org", the valid entries would syntactically fall into three categories:
- Subdomains (and the contents of those subdomains) of mozilla.org ("server.office.mozilla.org")
- hostnames in mozilla.org ("www.mozilla.org")
- node-level entries of mozilla.org ("mozilla.org").
You cannot specify a prefix that will do a suffixed-string compare that will match all three cases precisely.
- ".mozilla.org" will not match "mozilla.org"
- "mozilla.org" will match all three cases, but also match any domains that end in the string "mozilla.org", such as "www.amozilla.org".
Contributors can test this feature, even without a proxy server, using a "negative proxy server test". Proxy connections that fail return an error "The proxy server you have configured cannot be found", so configure your browser to use a non-existent HTTP proxy (hostname: "imaginary", port "80"). Test each destination in an http: URL. All proxied URLs will return errors, all non-proxied connections will be attempted normally (direct connection).
|basic filtering unit tests (local host)||localhost||localhost||direct|
|confirm the filter uses only suffix matches (hostname unit tests)||hostname||hostname||direct|
|domains with numbers||3com.com||.3com.com||direct|
|*.domain.com||*.domain.com||same results as ".domain.com"|
|*domain.com||same results as "domain.com"|
|host IP address||127.0.0.1||127.0.0.1||direct|
The no_proxy for logic is written in C++. PAC is written in JS, so there are potential problems with feature consistency and porting. David Baron has pointed out that the original PAC code in the "classic" tree is written in C++. The PAC in C++ has not been tested in mozilla, so porting PAC in C++ forward would not be a panacea.
The relevant code lives in nsProtocolProxyService.cpp.
- nsProtocolProxyService::PrefsChanged - loads preferences
- nsProtocolProxyService::LoadFilters - parses filters
- nsProtocolProxyService::ExamineForProxy - decides to check filters if configuration is "manual"
- nsProtocolProxyService::CanUseProxy - performs URL vs. filter comparison
- bug 172083 - [meta] Proxy: "no proxy for" items
- bug 80917 - Proxy: "No Proxy" w/ form based UI
- bug 91587 - Proxy: "no proxy for" default domain filtering fails w/ non-FQDN (e.g., http://web/)
- bug 201685 - No proxy for: support IPv6 address literals
- bug 136789 - Proxy: no proxy IP entries do not block DNS resolved IPs
- bug 314712 - No proxy for: "hostname.domain.com" should block only "hostname.domain.com"
- bug 72444 - Proxy: "bypass proxy server for local addresses" (IE pref)
- bug 260883 - "No proxy for" does not use FQDN wildcards "*" like IE
bug 17158 comment 21:
the correct separator are spaces or commas. So use this-
dogwood.state.mo.us .intra.state.mo.us dor.intranet
dogwood.state.mo.us, .intra.state.mo.us, dor.intranet
Note that you don't need to (read shouldn't) put a * for all hosts with that
domain ending. Corollary- a no_proxies_on entry of netscape.com will be
applicable to all hosts ending at netscape.com including foonetscape.com but an
entry of .netscape.com will specifically be applicable to all hosts in the
domain of netscape.com.
Original Document Information
- Author(s): Benjamin Chuang
- Last Updated Date: November 2, 2005
- Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.