33This page describes how to write rulesets for [ HTTPS
44Everywhere] ( https://eff.org/https-everywhere ) , a browser extension that
55switches sites over from HTTP to HTTPS automatically. HTTPS Everywhere comes
6- with [ thousands] ( http ://www .eff.org/https-everywhere/atlas/ ) of rulesets that
6+ with [ thousands] ( https ://atlas .eff.org/index.html ) of rulesets that
77tell HTTPS Everywhere which sites it should switch to HTTPS and how. If there
88is a site that offers HTTPS and is not handled by the extension, this guide
99will explain how to add that site.
1010
1111#### [ Rulesets] ( #rulesets )
1212
13- A ` ruleset ` is an [ XML] ( http ://www.xml.com/pub/a/98/10/guide0.html?page=2) file
13+ A ` ruleset ` is an [ XML] ( https ://www.xml.com/pub/a/98/10/guide0.html?page=2) file
1414describing behavior for a site or group of sites. A ruleset contains one or
1515more ` rules ` . For example, here is
1616[ ` RabbitMQ.xml ` ] ( https://github.com/efforg/https-everywhere/blob/master/src/chrome/content/rules/RabbitMQ.xml ) ,
1717from the addon distribution:
1818
1919``` xml
2020<ruleset name =" RabbitMQ" >
21- <target host =" rabbitmq.com" />
22- <target host =" www.rabbitmq.com" />
21+ <target host =" rabbitmq.com" />
22+ <target host =" www.rabbitmq.com" />
2323
24- <rule from =" ^http:"
25- to =" https:" />
24+ <rule from =" ^http:"
25+ to=" https:" />
2626</ruleset >
2727```
2828
@@ -37,7 +37,7 @@ match that host name.
3737
3838HTTPS Everywhere then tries each rule in those rulesets against the full URL.
3939If the [ Regular
40- Expression] ( http ://www.regular-expressions.info/quickstart.html) , or regexp, in
40+ Expression] ( https ://www.regular-expressions.info/quickstart.html) , or regexp, in
4141one of those rules matches, HTTPS Everywhere [ rewrites the
4242URL] ( #rules-and-regular-expressions ) according the ` to ` attribute of the rule.
4343
@@ -58,16 +58,16 @@ separate target.
5858#### [ Rules and Regular Expressions] ( #rules-and-regular-expressions )
5959
6060The ` rule ` tags do the actual rewriting work. The ` from ` attribute of each rule
61- is a [ regular expression] ( http ://www.regular-expressions.info/quickstart.html)
61+ is a [ regular expression] ( https ://www.regular-expressions.info/quickstart.html)
6262matched against a full URL. You can use rules to rewrite URLs in simple or
6363complicated ways. Here's a simplified (and now obsolete) example for Wikipedia:
6464
6565``` xml
6666<ruleset name =" Wikipedia" >
67- <target host =" *.wikipedia.org" />
67+ <target host =" *.wikipedia.org" />
6868
69- <rule from =" ^http://(\w{2})\.wikipedia\.org/wiki/"
70- to =" https://secure.wikimedia.org/wikipedia/$1/wiki/" />
69+ <rule from =" ^http://(\w{2})\.wikipedia\.org/wiki/"
70+ to=" https://secure.wikimedia.org/wikipedia/$1/wiki/" />
7171</ruleset >
7272```
7373
@@ -84,9 +84,9 @@ between rulesets is unspecified. Only the first rule or exception matching a
8484given URL is applied.
8585
8686Rules are evaluated using [ Javascript regular
87- expressions] ( http ://www.regular-expressions.info/javascript.html) , which are
87+ expressions] ( https ://www.regular-expressions.info/javascript.html) , which are
8888similar but not identical to [ Perl-style regular
89- expressions.] ( http ://www.regular-expressions.info/pcre.html) Note that if your
89+ expressions.] ( https ://www.regular-expressions.info/pcre.html) Note that if your
9090rules include ampersands (& ; ), they need to be appropriately XML-encoded:
9191replace each occurrence of ** & ; ** with ** & ; #x26;** .
9292
@@ -97,7 +97,7 @@ the rule should **not** be applied. The Stack Exchange rule contains an
9797exclusion for the OpenID login path, which breaks logins if it is rewritten:
9898
9999``` xml
100- <exclusion pattern =" ^http://(?: \w+\.)?stack(?: exchange|overflow)\.com/users/authenticate/" />
100+ <exclusion pattern =" ^http://(\w+\.)?stack(exchange|overflow)\.com/users/authenticate/" />
101101```
102102
103103Exclusions are always evaluated before rules in a given ruleset. Matching any
@@ -118,7 +118,7 @@ less cumbersome.
118118#### [ Secure Cookies] ( #secure-cookies )
119119
120120Many HTTPS websites fail to correctly set the [ secure
121- flag] ( https://secure.wikimedia .org/wikipedia/en /wiki/HTTP_cookie#Secure_and_HttpOnly )
121+ flag] ( https://en.wikipedia .org/wiki/HTTP_cookie#Secure_and_HttpOnly )
122122on authentication and/or tracking cookies. HTTPS Everywhere provides a facility
123123for turning this flag on. For instance:
124124
@@ -189,8 +189,8 @@ element, with a value explaining why the rule is off.
189189
190190``` xml
191191<ruleset name =" Amazon (buggy)" default_off =" breaks site" >
192- <target host =" www.amazon.*" />
193- <target host =" amazon.*" />
192+ <target host =" www.amazon.*" />
193+ <target host =" amazon.*" />
194194</ruleset >
195195```
196196
@@ -200,13 +200,9 @@ file.
200200#### [ Mixed Content Blocking (MCB)] ( #mixed-content-blocking-mcb )
201201
202202Some rulesets may trigger active mixed content (i.e. scripts loaded over HTTP
203- instead of HTTPS). This type of mixed content is blocked in both
204- [ Chrome] ( https://trac.torproject.org/projects/tor/ticket/6975 ) and Firefox,
203+ instead of HTTPS). This type of mixed content is blocked in most major browsers,
205204before HTTPS Everywhere has a chance to rewrite the URLs to an HTTPS version.
206- This generally breaks the site. However, the Tor Browser doesn&apos ; t block
207- mixed content, in order to allow HTTPS Everywhere to try and rewrite the URLs
208- to an HTTPS version.
209-
210- To enable a rule only on platforms that allow mixed content (currently only the
211- Tor Browser), you can add a ` platform="mixedcontent" ` attribute to the ruleset
212- element.
205+ This generally breaks the site. Depending on their configuration and threat
206+ model, some users might however decide to enable these rulesets via a global
207+ option in HTTPS Everywhere. To that effect, such rulesets are identified with
208+ the specific ` platform="mixedcontent" ` attribute to the ruleset element.
0 commit comments