Home arrow Ruleset arrow Ruleset Tutorial
Ruleset Tutorial
Firecoral uses a list of rules to determine when to redirect the browser to the Firecoral proxy. To achieve this, there are three types of rules allowed in Firecoral:


Whitelist Wildcard

The whitelist wildcard is simple. If you want to redirect all URLs of a domain to Firecoral, you can create a rule like this:

  • Domain: *.example.com
  • XPath: *

With this rule active, any URL that comes in matching this domain will be redirected to Firecoral. Some examples:

  • http://example.com/image.gif
  • http://www.example.com/
  • http://subuser.example.com/subdir/subpage.html

Whitelist XPath

XPath rules are more complicated. Rather than specifying a domain that should use Firecoral, these rules specify an XPath query that should be run on the specified domain to pluck out links from the page. XPath is a query language for XML documents, and Firecoral uses these queries to quickly parse a page.

For example, if we want to use Firecoral for all external links that come from Slashdot, this is not possible with a simple Whitelist Wildcard rule, as we don't know the URL's that Slashdot is going to link to in the future. Instead, we have a Whitelist XPath rule:

  • Domain: *.slashdot.org
  • XPath: //div[@class='body' or @class='commentBody']/descendant::a[starts-with(@href, 'http://')]/@href

I won't go into details about the XPath language here. To construct the query, one must look at the HTML output of the site you're evaluating in and figure out a query that will select only the links wanted. The add-ons XPath Checker and XPather are extremely helpful for this task.

With this specific rule active, any external links from Slashdot (i.e. links that are not relative to other Slashdot pages) will be extracted when the page loads and added to the list of URL's to send to Firecoral.

Blacklist Wildcard

Since the Whitelist XPath rules can potentially introduce URL's to any site, Firecoral also lets you specify domains that should never by sent to Firecoral. For example, cnn.com is a fast, geographically distributed website that wouldn't get much benefit from using Firecoral. Therefore, if a Slashdot article links to CNN, we may not want to use Firecoral. To address this issue, Firecoral supports Blacklist Wildcard rules. They are in the same format as the Whitelist Wildcard. For example, to prevent any CNN URL from going to Firecoral:

  • Domain: *.cnn.com
  • XPath: *

With this rule active, even if a URL to CNN is parsed from a Whitelist Wildcard rule, this blacklist rule will override and not send the URL to Firecoral.