Skip to content

Commit 3eb8ee5

Browse files
committed
Merge pull request EFForg#2702 from EFForg/style-update
Update style guidelines to talk about snapping redirects.
2 parents dc50600 + defb980 commit 3eb8ee5

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎ruleset-style.md‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ To that end, here are some style guidelines for writing or modifying rulesets.
77
They are intended to help and simplify in places where choices are ambiguous,
88
but like all guidelines they can be broken if the circumstances require it.
99

10-
Avoid using the left-wildcard ("<target host='*.example.com'>") unless you
11-
really mean it. Many rules today specify a left-wildcard target, but the
12-
rewrite rules only rewrite an explicit list of hostnames.
10+
Avoid using the left-wildcard ("<target host='*.example.com'>") unless
11+
you intend to rewrite all or nearly all subdomains. Many rules today specify
12+
a left-wildcard target, but the rewrite rules only rewrite an explicit list
13+
of hostnames.
1314

1415
Instead, prefer listing explicit target hosts and a single rewrite from "^http:" to
1516
"^https:". This saves you time as a ruleset author because each explicit target
@@ -55,7 +56,14 @@ non-capturing form adds extra line noise that makes rules harder to read.
5556
Generally you can achieve the same effect by choosing a correspondingly higher
5657
index for your replacement group to account for the groups you don't care about.
5758

58-
Here is an example ruleset today:
59+
Avoid snapping redirects. For instance, if https://foo.fm serves HTTPS
60+
correctly, but redirects to https://foo.com, it's tempting to rewrite foo.fm to
61+
foo.com, to save users the latency of the redirect. However, such rulesets are
62+
less obviously correct and require more scrutiny. And the redirect can go out of
63+
date and cause problems. HTTPS Everywhere rulesets should change requests the minimum
64+
amount necessary to ensure a secure connection.
65+
66+
Here is an example ruleset pre-style guidelines:
5967

6068
```
6169
<ruleset name="WHATWG.org">

0 commit comments

Comments
 (0)