URL Patterns

  1. Home
  2. Browser Extension Help
  3. URL Patterns

When the FoxyProxy browser extension is set to Use proxies based on their pre-defined patterns and priorities, the browser asks FoxyProxy if a proxy should be used to load 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.

Read more about how FoxyProxy uses patterns here: The FoxyProxy Rules Engine: Whitelists, Blacklists, and Patterns.

Please note that all patterns — white and black — are ignored when FoxyProxy is set to “Use proxy XXXX 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 Linux, 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/*

My blacklist pattern doesn’t seem to work

I need to disable proxy routing when I go to addresses like 71.0.0.93. I created URL pattern *71.0.0.93* and switch entry to “Blacklist” option but there’s no effect on routing.

Make sure you follow these steps (#3 and #4 are often forgotten):

  1. Define proxy using “Add New Proxy” button. Enter details on Proxy Details tab.
  2. On URL Patterns tab, enter blacklist pattern, like *71.0.0.93*
  3. Enter whitelist pattern, like * (MATCH EVERYTHING)
  4. Set FoxyProxy to “Use proxies based on their pre-defined patterns and priorities”

You can confirm that 71.0.0.93 is NOT going through the proxy by turning on FoxyProxy Logging (Logging tab -> Enabled checkbox, use Refresh button after visiting 71.0.0.93). Logging is not yet available on FoxyProxy for Chrome.

Other problems/questions with patterns? Be sure to read this.

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 powerful 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 converts wildcard patterns into regular expressions and surrounds them with anchors (^ and $). But it does not do that for regular expression patterns. You should add those anchors 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.

Identifying URLs that require patterns

If you want only some webpages or websites to load through a proxy, and not all, you need to use FoxyProxy in patterns mode. But you need to create the pattern rules first. To determine which pattern you need, FoxyProxy has a logging feature. This feature displays all URLs used by a website or webpage. With FoxyProxy Plus, you can automatically create patterns from the log.. Here how to use the logging feature:

  • 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 the browser, 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.

With FoxyProxy Plus, you can automatically create patterns from the log.

Read more about how FoxyProxy uses patterns here: The FoxyProxy Rules Engine: Whitelists, Blacklists, and Patterns.