URL Patterns

When FoxyProxy is set to "Use proxies based on their pre-defined patterns and priorities", Firefox asks FoxyProxy if a proxy should be used before loading URLs. FoxyProxy answers this question by attempting to match the current URL with all of the URL patterns you've configured. This process is extremely fast. There are two ways to match URLs with FoxyProxy: wildcards or regular expressions. Please note that all patterns -- white and black -- are ignored when FoxyProxy is set to "Use proxy ABC for all URLs".

Whitelists and Blacklists

When you write a URL pattern, you must select whether it is either a whitelisted pattern or a blacklisted pattern. Whitelist patterns define URLs that should be loaded through a proxy, while blacklist patterns define URLs that should not be loaded through the proxy specified for this pattern. Every proxy you define can have its own whitelist patterns and blacklist patterns. If a URL matches patterns in both the whitelist and the blacklist for a proxy, the blacklist takes priority; the URL is not loaded through that proxy. It may, however, load through another proxy you've defined if that proxy has a matching whitelist pattern and no matching blacklist pattern.

Wildcards

Wildcards are pervasive throughout computing; you've most likely seen them before. The asterisk (*) substitutes as a wildcard character for zero or more characters, and the question mark (?) substitutes as a wildcard character for any one character. In Unix, this is referred to as glob expansion.

Wildcard Examples

URL Pattern: *.yahoo.com/*

Some Matches
Some Non-Matches
Everything in Yahoo's domainhttp://mail.google.com/

URL Pattern: *mail.yahoo.com*

Some Matches
Some Non-Matches
http://mail.yahoo.com/
https://1.mail.yahoo.com.spoof.net/
http://mail.yahoo.com/clownshoes/
http://mail.yahoo.com/inbox/123.html
ftp://mail.yahoo.com
http://maps.yahoo.com

URL Pattern: http://??.wikipedia.org/wiki/Clown

Some Matches
Some Non-Matches
http://en.wikipedia.org/wiki/Clown
http://de.wikipedia.org/wiki/Clown
http://cs.wikipedia.org/wiki/Clown
https://en.wikipedia.org/wiki/Clown
http://de.wikipedia.org/wiki/Clown/
ftp://en.wikipedia.org/wiki/Clown

URL Pattern: http://digg.com/

Some Matches
Some Non-Matches
http://digg.com/ http://digg.com
http://www.digg.com/

URL Pattern: *://*.asimov.???/*

Some Matches
Some Non-Matches
ftp://ftp.asimov.net/
ftp://ftp.asimov.com/theory.html
http://bear.asimov.net/mom/
https://isaac.asimov.org/hercules
gopher://asimov.net/
ftp://ftp.asimov.co.uk
http://isaac.home.com/tin.php

URL Pattern: *

Some Matches
Some Non-Matches
Matches everything

URL Pattern: http://www.abc.com/foo.html

Some Matches
Some Non-Matches
http://www.abc.com/foo.htmlEverything but http://www.abc.com/foo.html


Common Mistakes When Writing Wildcard Patterns

Here are some common mistakes when writing wildcard patterns. The valid equivalent is shown.

Invalid

Valid

http://www.myspace.comhttp://www.myspace.com/*
localhost, 127.0.0.1Must be TWO patterns:
*://localhost/*
*://127.0.0.1/*
.abc.com*.abc.com/*
eric.abc.com*eric.abc.com/*


Regular Expressions

Regular expressions are also pervasive throughout computing, although they are sometimes considered an advanced topic. Regular expressions are like "wildcards on steroids" because they are more poweful and flexible, but their goal is similar to wildcards: define a means to find arbitrary text within a string.

For those already familiar with regular expressions, FoxyProxy adheres to the JavaScript regular expression syntax. When in doubt, refer to this guide and the more technical, more thorough ECMAScript Language Specification [pdf], chapter 15.10. Some points to note:

  • Do not surround regular expressions in FoxyProxy with forward slashes like this: /abc/
  • FoxyProxy automatically surrounds wildcard patterns into regular expressions and surrounds them with anchors (^ and $). But it does not do that for regular expression patterns. You should add them if you want their behaviors: for ^, URLs must begin with your pattern in order to match. For $, URLs containing your pattern must end with your pattern.

Further Reading

Entire books have been written about regular expressions, so rather than discuss them here, we refer you to some free, valuable on-line resources which teach everything you need to know about them. This list is by no means concise, and we have no affiliation with these resources.

Thanks, Wikipedia.

Identifying URLs which require patterns

  • Enable logging in FoxyProxy (Ctrl+F2 to open FoxyProxy then go to the Logging tab and click the "Enabled" checkbox). Ensure "Do not store or display URLs" is UNCHECKED.
  • In Firefox, visit desired website or resource (for example, begin playing the video on a video website).
  • Click "Refresh" in the FoxyProxy logging tab. You will see the URL from which the video played / streamed. This is the URL you should create a pattern for.