
{"id":151,"date":"2016-01-14T10:00:17","date_gmt":"2016-01-14T10:00:17","guid":{"rendered":"http:\/\/help.getfoxyproxy.org\/?post_type=ht_kb&#038;p=151"},"modified":"2016-03-01T11:56:04","modified_gmt":"2016-03-01T11:56:04","slug":"url-patterns","status":"publish","type":"ht_kb","link":"https:\/\/help.getfoxyproxy.com\/index.php\/knowledge-base\/url-patterns\/","title":{"rendered":"URL Patterns"},"content":{"rendered":"<p>When the FoxyProxy browser extension is set to <strong>Use proxies based on their pre-defined patterns and priorities<\/strong>, 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&#8217;ve configured. This process is extremely fast. There are two ways to match URLs with FoxyProxy: <a href=\"#wildcards\">wildcards<\/a> or <a href=\"#regex\">regular expressions<\/a>.<\/p>\n<p><strong>Read more about how FoxyProxy uses patterns here: <a href=\"\/index.php\/knowledge-base\/browser-extension-manual\/#patterns\">The FoxyProxy Rules Engine: Whitelists, Blacklists, and Patterns<\/a><\/strong>.<\/p>\n<p><strong>Please note that all patterns &#8212; white and black &#8212; are ignored when FoxyProxy is set to &#8220;Use proxy XXXX for all URLs&#8221;.<\/strong><\/p>\n<h4 id=\"whitelists_and_blacklists\">Whitelists and Blacklists<\/h4>\n<p>When you write a URL pattern, you must select whether it is either a <a href=\"https:\/\/wikipedia.org\/wiki\/Whitelist\">whitelisted<\/a> pattern or a <a href=\"https:\/\/wikipedia.org\/wiki\/Blacklisting\">blacklisted<\/a> pattern. Whitelist patterns define URLs that should be loaded through a proxy, while blacklist patterns define URLs that should <strong>not<\/strong> be loaded through <strong>the proxy specified for this pattern<\/strong>. Every proxy you define can have its own whitelist patterns and blacklist patterns. If a URL matches patterns in both the whitelist <strong>and<\/strong> the blacklist for a proxy, the blacklist takes priority; the URL is <strong>not<\/strong> loaded through <strong><i>that<\/i><\/strong> proxy. It may, however, load through another proxy you&#8217;ve defined if that proxy has a matching whitelist pattern and no matching blacklist pattern.<\/p>\n<h4 id=\"wildcards\">Wildcards<\/h4>\n<p><a href=\"https:\/\/wikipedia.org\/wiki\/Wildcard_character\">Wildcards<\/a> are pervasive throughout computing; you&#8217;ve most likely seen them before. The <a href=\"https:\/\/wikipedia.org\/wiki\/Asterisk\">asterisk<\/a> (*) 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 <a href=\"https:\/\/wikipedia.org\/wiki\/Glob_(programming)\">glob expansion<\/a>.<\/p>\n<h4>Wildcard Examples<\/h4>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> *.yahoo.com\/*<\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>Everything in Yahoo&#8217;s domain<\/td>\n<td>http:\/\/mail.google.com\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> *mail.yahoo.com* <\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/mail.yahoo.com\/<br \/>\nhttps:\/\/1.mail.yahoo.com.spoof.net\/<br \/>\nhttp:\/\/mail.yahoo.com\/clownshoes\/<br \/>\nhttp:\/\/mail.yahoo.com\/inbox\/123.html<br \/>\nftp:\/\/mail.yahoo.com<\/td>\n<td>http:\/\/maps.yahoo.com<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> http:\/\/??.wikipedia.org\/wiki\/Clown<\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/en.wikipedia.org\/wiki\/Clown<br \/>\nhttp:\/\/de.wikipedia.org\/wiki\/Clown<br \/>\nhttp:\/\/cs.wikipedia.org\/wiki\/Clown<\/td>\n<td>https:\/\/en.wikipedia.org\/wiki\/Clown<br \/>\nhttp:\/\/de.wikipedia.org\/wiki\/Clown\/<br \/>\nftp:\/\/en.wikipedia.org\/wiki\/Clown<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> http:\/\/digg.com\/ <\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/digg.com\/<\/td>\n<td>http:\/\/digg.com<br \/>\nhttp:\/\/www.digg.com\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> *:\/\/*.asimov.???\/* <\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>ftp:\/\/ftp.asimov.net\/<br \/>\nftp:\/\/ftp.asimov.com\/theory.html<br \/>\nhttp:\/\/bear.asimov.net\/mom\/<br \/>\nhttps:\/\/isaac.asimov.org\/hercules<br \/>\ngopher:\/\/asimov.net\/<\/td>\n<td>ftp:\/\/ftp.asimov.co.uk<br \/>\nhttp:\/\/isaac.home.com\/tin.php<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> * <\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>Matches everything<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">URL Pattern: <span class=\"pattern\"> http:\/\/www.abc.com\/foo.html <\/span><\/td>\n<\/tr>\n<tr>\n<td>\n<h6>Some Matches<\/h6>\n<\/td>\n<td>\n<h6>Some Non-Matches<\/h6>\n<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/www.abc.com\/foo.html<\/td>\n<td>Everything but http:\/\/www.abc.com\/foo.html<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"mistakes\">Common Mistakes When Writing Wildcard Patterns<\/h4>\n<p>Here are some common mistakes when writing wildcard patterns. The valid equivalent is shown.<\/p>\n<table>\n<thead>\n<tr>\n<td>\n<h6>Invalid<\/h6>\n<\/td>\n<td>\n<h6>Valid<\/h6>\n<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>http:\/\/www.myspace.com<\/td>\n<td>http:\/\/www.myspace.com\/*<\/td>\n<\/tr>\n<tr>\n<td>localhost, 127.0.0.1<\/td>\n<td>Must be TWO patterns:<br \/>\n*:\/\/localhost\/*<br \/>\n*:\/\/127.0.0.1\/*<\/td>\n<\/tr>\n<tr>\n<td>.abc.com<\/td>\n<td>*.abc.com\/*<\/td>\n<\/tr>\n<tr>\n<td>eric.abc.com<\/td>\n<td>*eric.abc.com\/*<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>My blacklist pattern doesn&#8217;t seem to work<\/h4>\n<p><i>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 &#8220;Blacklist&#8221; option but there&#8217;s no effect on routing.<\/i><\/p>\n<p>Make sure you follow these steps (#3 and #4 are often forgotten):<\/p>\n<ol>\n<li>Define proxy using &#8220;Add New Proxy&#8221; button. Enter details on Proxy Details tab.<\/li>\n<li>On URL Patterns tab, enter blacklist pattern, like *71.0.0.93*<\/li>\n<li>Enter whitelist pattern, like * (MATCH EVERYTHING)<\/li>\n<li>Set FoxyProxy to &#8220;Use proxies based on their pre-defined patterns and priorities&#8221;<\/li>\n<\/ol>\n<p>You can confirm that 71.0.0.93 is NOT going through the proxy by turning on FoxyProxy Logging (Logging tab -&gt; Enabled checkbox, use Refresh button after visiting 71.0.0.93). Logging is not yet available on FoxyProxy for Chrome.<\/p>\n<p>Other problems\/questions with patterns? Be sure to <a href=\"https:\/\/getfoxyproxy.org\/mozilla\/faq.html#patterns\">read this<\/a>.<\/p>\n<h4 id=\"regex\">Regular Expressions<\/h4>\n<p><a href=\"https:\/\/wikipedia.org\/wiki\/Regular_expression\">Regular expressions<\/a> are also pervasive throughout computing, although they are sometimes considered an advanced topic. Regular expressions are like &#8220;wildcards on steroids&#8221; because they are more powerful and flexible, but their goal is similar to wildcards: define a means to find arbitrary text within a string.<\/p>\n<p>For those already familiar with regular expressions, FoxyProxy adheres to the JavaScript regular expression syntax. When in doubt, refer to <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Guide\/Regular_Expressions\">this guide<\/a> and the more technical, more thorough <a href=\"http:\/\/www.ecma-international.org\/publications\/files\/ECMA-ST\/Ecma-262.pdf\">ECMAScript Language Specification<\/a> [pdf], chapter 15.10. Some points to note:<\/p>\n<ul class=\"circle\">\n<li>Do not surround regular expressions in FoxyProxy with forward slashes like this: <b>\/abc\/<\/b><\/li>\n<li>FoxyProxy automatically converts <a href=\"#wildcards\">wildcard patterns<\/a> into regular expressions and surrounds them with anchors (<strong>^<\/strong> and <strong>$<\/strong>). But it does not do that for regular expression patterns. You should add those anchors if you want their behaviors: for <strong>^<\/strong>, URLs must <i>begin<\/i> with your pattern in order to match. For <strong>$<\/strong>, URLs containing your pattern must <i>end<\/i> with your pattern.<\/li>\n<\/ul>\n<h5>Further Reading<\/h5>\n<p>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.<\/p>\n<ul>\n<li><a title=\"http:\/\/www.regular-expressions.info\" href=\"http:\/\/www.regular-expressions.info\">Regular Expression Tutorial and Reference<\/a> One of the most comprehensive, free regular expression tutorials on the net.<\/li>\n<li><a title=\"http:\/\/regexadvice.com\/\" href=\"http:\/\/regexadvice.com\/\">RegexAdvice.com<\/a> Forums and blogs dedicated to regular expressions.<\/li>\n<li><a title=\"http:\/\/www.regexlib.com\/\" href=\"http:\/\/www.regexlib.com\/\">Regular Expression Library<\/a> Currently contains over 1000 expressions from contributors around the world.<\/li>\n<li><a title=\"http:\/\/regexlib.com\/cheatsheet.aspx\" href=\"http:\/\/regexlib.com\/cheatsheet.aspx\">Regular Expression Cheat Sheet<\/a> A one page printable reference for regular expressions<\/li>\n<\/ul>\n<h4>Identifying URLs that require patterns<\/h4>\n<p>If you want only <strong>some<\/strong> webpages or websites to load through a proxy, and not all, you need to use FoxyProxy in <strong>patterns mode<\/strong>. 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. <strong>With FoxyProxy Plus, you can automatically create patterns from the log.<\/strong>. Here how to use the logging feature:<\/p>\n<ul>\n<li>Enable logging in FoxyProxy (Ctrl+F2 to open FoxyProxy then go to the Logging tab and click the &#8220;Enabled&#8221; checkbox). Ensure &#8220;Do not store or display URLs&#8221; is UNCHECKED.<\/li>\n<li>In the browser, visit desired website or resource. For example, begin playing the video on a video website.<\/li>\n<li>Click &#8220;Refresh&#8221; 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.<\/li>\n<\/ul>\n<p><strong>With FoxyProxy Plus, you can automatically create patterns from the log.<\/strong><\/p>\n<p><strong>Read more about how FoxyProxy uses patterns here: <a href=\"\/index.php\/knowledge-base\/browser-extension-manual\/#patterns\">The FoxyProxy Rules Engine: Whitelists, Blacklists, and Patterns<\/a><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ve configured. This process is extremely fast. There [&hellip;]<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[100],"ht-kb-tag":[25,27,26,28],"_links":{"self":[{"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/151"}],"collection":[{"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/comments?post=151"}],"version-history":[{"count":14,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/151\/revisions"}],"predecessor-version":[{"id":590,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/151\/revisions\/590"}],"wp:attachment":[{"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/media?parent=151"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb-category?post=151"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/help.getfoxyproxy.com\/index.php\/wp-json\/wp\/v2\/ht-kb-tag?post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}