- Notifications
You must be signed in to change notification settings - Fork 153
Proxy Rules
When in Smart Rules profile type, the decision to decide whether to apply to a request is made using Rules. Rules can be defined from the Add Rule popup window or from the popup menu in the browser toolbar.
In order to understand the rules you should know their types.

Proxy rules help you control when your browser should use a proxy server for certain websites. Each rule defines a pattern that matches specific websites (URLs or domains). When a website matches a rule:
- If it's a proxy rule, the browser will route the traffic through your selected proxy server.
- If it's a whitelist rule (also called bypass), the browser will connect directly without using the proxy.
Rules are checked in order for each web request. The first matching rule decides what to do. This makes it easy to customize your browsing experience, like using a proxy for work sites but connecting directly to personal sites.
Currently these are the types of the rules that can be used to add rules within a Smart Rule profile.
- Host Wildcard (Match Pattern)
Uses match patterns on host name - Url Wildcard (Match Pattern)
Uses match patterns on url - Host regex
Uses regex expressions on host name - Url regex
Uses regex expressions on url - Exact Url
The exact url should match - DomainSubdomain
Matches root domain and all subdomains of the expression. - IP Range (CIDR Notation)
Matches IP addresses within a specified range.
From this list the type DomainSubdomain is the one that is used when a new rule is added from the popup menu of the browser. That is the simplest and also fastest in terms of performance impact.
What is a Host?
Host is used in rules a lot so it is important to know the exact meaning.
The host property of the URL interface is a string containing the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', followed by the port of the URL.
let url = new URL('https://developer.mozilla.org/en-US/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org" url = new URL('https://developer.mozilla.org:443/en-US/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org" // The port number is not included because 443 is the scheme's default port url = new URL('https://developer.mozilla.org:4097/en-US/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org:4097" Now that the meaning is clear let's dig into the details of each rule type.
This type of rule only requires the Rule Source Domain.
The rule is very simple, host name will be used to match the rule expression and also its subdomains. This type of rule matches the specified domain and all its subdomains. It's useful for applying rules to an entire website family, like all parts of example.com.
| DomainSubdomain | Match | Doesn't Match |
|---|---|---|
| example.com | example.com www.example.com sub.example.com sub1.sub2.example.com example.com:80 sub.example.com:80 example.com:443 sub.example.com:443 | example.com:2030 xample.com example.net |
| sub.example.com | sub.example.com sub2.sub.example.com:80 | other.example.com sub.example.com:2020 |
| example.com:8080 | example.com:8080 sub.example.com:8080 | example.com:80 example.com:443 |
Note: 80 and 443 are the scheme's default port and if the rule doesn't specify port number these defaults may apply.
This rule uses simple wildcard patterns to match hostnames. It's like a simplified way to match domains with wildcards. Patterns must be valid for hostnames.
| Host Wildcard (Match Pattern) | Match | Doesn't Match |
|---|---|---|
| *.example.com | www.example.com api.example.com sub.example.com | example.com example.net www.example.org |
| *.sub.example.com | test.sub.example.com api.sub.example.com | sub.example.com example.com |
| example.com:8080 | example.com:8080 | example.com www.example.com:8080 |
Similar to Host Wildcard, but matches the entire URL instead of just the hostname. Use this for more specific URL matching.
| Url Wildcard (Match Pattern) | Match | Doesn't Match |
|---|---|---|
| ://.example.com/* | https://www.example.com/page http://api.example.com/data | https://example.com https://example.net/page |
| ://.example.com:8080/* | https://www.example.com:8080/api http://api.example.com:8080/v1 | https://www.example.com/api https://api.example.com:80/api |
| https://example.com/* | https://example.com/page https://example.com/api/v1 | http://example.com/page https://www.example.com/page |
This rule uses regular expressions to match hostnames. It's powerful for complex patterns but requires knowledge of regex.
| Host Regex | Match | Doesn't Match |
|---|---|---|
| ^.*.example.com$ | www.example.com api.example.com sub.example.com | example.com example.net wwwexample.com |
| ^sub.example.com$ | sub.example.com | example.com sub2.sub.example.com |
| ^example.com:8080$ | example.com:8080 | example.com example.com:80 |
This rule uses regular expressions to match full URLs. Very flexible for advanced matching needs.
| Url Regex | Match | Doesn't Match |
|---|---|---|
| https?://..example.com/. | https://www.example.com/page http://api.example.com/data | ftp://example.com/file https://example.net/page |
| ^https://example\.com:8080/.*$ | https://example.com:8080/api https://example.com:8080/v1 | https://example.com/api http://example.com:8080/api |
| .example.com./api | https://www.example.com/api http://api.example.com/api/v1 | https://example.com/page |
This rule matches the exact, complete URL. Use it for very specific pages.
This rule matches IP addresses within a specified range using CIDR notation. Useful for targeting IP-based resources.
| IP CIDR Notation | Match | Doesn't Match |
|---|---|---|
| IP: 192.168.1.0 Prefix: 24 | 192.168.1.1 192.168.1.100 192.168.1.254 | 192.168.2.1 10.0.0.1 |
| IP: 10.0.0.0 Prefix: 8 | 10.1.2.3 10.255.255.255 | 192.168.1.1 172.16.0.1 |