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 a proxy. Every proxy you define has 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.
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 domain | http://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.html | Everything 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.com | http://www.myspace.com/* |
| localhost, 127.0.0.1 | Must 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 with which to match arbitrary text.
For those already familiar with regular expressions, FoxyProxy adheres to the JavaScript 1.5 regular expression syntax. When
in doubt, refer to this guide
and the more technical, more thorough ECMAScript Language Specification, chapter 15.10 [pdf].
Do not surround regular expressions in FoxyProxy with forward slashes like this: /abc/
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.
- Regular Expression Tutorial and Reference One of the most comprehensive, free regular expression tutorials on the net.
- RegexAdvice.com Forums and blogs dedicated to regular expressions.
- Regular Expression Library Currently contains over 1000 expressions from contributors around the world.
- Using Regular Expressions Brief introduction to regular expressions
- Regular Expression Cheat Sheet A one page printable reference for regular expressions
- Regular expressions: a short tutorial A five-minute tutorial on how to learn the most useful regular expressions
- A List of Regex Topics Wiki with various topics about regular expressions.
- Mastering Regular Expressions Official website for Jeffrey Friedl's book.
- Regenechsen Beginners regular expression tutorial with exercises.
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.
