Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/web/templates/adblockplus.org.conf.erb

Issue 4808447505727488: Issue 2301 - Improve beta.adblockplus.org configuration (Closed)
Patch Set: Created April 15, 2015, 12:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # XSS and clickjacking prevention headers
2
3 set $csp_frame "";
4 if ($uri ~ ^/(:?\w\w(_\w\w)?/)?(?:index|firefox|chrome|opera|android|internet-ex plorer|safari|yandex-browser|maxthon)?$)
5 {
6 set $csp_frame "; frame-src www.youtube-nocookie.com;";
7 }
8 add_header Content-Security-Policy "default-src \'self\'; img-src * data:; style -src \'self\' \'unsafe-inline\'; script-src \'self\' \'unsafe-inline\' \'unsafe- eval\' $csp_frame";
9 add_header X-Frame-Options "sameorigin";
10
11 # User agent sniffing
12
13 set $user_agent "";
14 if ($http_user_agent ~ \bGecko/\d+)
15 {
16 set $user_agent "firefox";
17 }
18 if ($http_user_agent ~ \bSafari/\d+)
19 {
20 set $user_agent "safari";
21 }
22 if ($http_user_agent ~ \bChrome/\d+)
23 {
24 set $user_agent "chrome";
25 }
26 if ($http_user_agent ~ \bMSIE\ \d+)
27 {
28 set $user_agent "internet-explorer";
29 }
30 if ($http_user_agent ~ \bTrident/\d+)
31 {
32 set $user_agent "internet-explorer";
33 }
34 if ($http_user_agent ~ \bEdge/\d+)
35 {
36 set $user_agent "internet-explorer";
37 }
38 if ($http_user_agent ~ \bPresto/\d+)
39 {
40 set $user_agent "opera";
41 }
42 if ($http_user_agent ~ \bOPR/\d+)
43 {
44 set $user_agent "opera";
45 }
46 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+)
47 {
48 set $user_agent "android";
49 }
50 if ($http_user_agent ~ \bYaBrowser/\d+)
51 {
52 set $user_agent "yandex-browser";
53 }
54 if ($http_user_agent ~ \bMaxthon/\d+)
55 {
56 set $user_agent "maxthon";
57 }
58
59 sub_filter \' id="content" class="\' \' id="content" class="ua-$user_agent \';
60
61 set $index_page "firefox";
62 if ($user_agent != "")
63 {
64 set $index_page $user_agent;
65 }
66
67 # Various redirects
68
69 rewrite ^/(\w\w(_\w\w)?/)?changelog-1.3.1$ /$1\changelog-1.3 permanent;
70 rewrite ^/downloads/(.*) https://downloads.adblockplus.org/$1 permanent;
71
72 location /redirect
73 {
74 if ($arg_link = "reporter_connect_issue")
75 {
76 rewrite ^ /forum/? redirect;
77 }
78 if ($arg_link = "reporter_other_link")
79 {
80 rewrite ^ /forum/? redirect;
81 }
82 if ($arg_link = "chrome_support")
83 {
84 rewrite ^ /forum/viewforum.php?f=10? redirect;
85 }
86 if ($arg_link = "opera_support")
87 {
88 rewrite ^ /forum/viewforum.php?f=14? redirect;
89 }
90 if ($arg_link = "safari_support")
91 {
92 rewrite ^ /forum/viewforum.php?f=18? redirect;
93 }
94 if ($arg_link = "knownIssuesChrome_filterstorage")
95 {
96 rewrite ^ /forum/viewtopic.php?t=23597? redirect;
97 }
98
99 set $lang "en";
100 set $link "";
101 set $anchor "";
102
103 if ($arg_link ~ "^share-")
104 {
105 set $link "share";
106 set $anchor "?a=minimal";
107 }
108 if ($arg_link = "gettingStarted")
109 {
110 set $link "getting_started";
111 }
112 if ($arg_link = "faq")
113 {
114 set $link "faq";
115 }
116 if ($arg_link = "filterdoc")
117 {
118 set $link "filters";
119 }
120 if ($arg_link = "subscriptions")
121 {
122 set $link "subscriptions";
123 }
124 if ($arg_link = "reporter_privacy")
125 {
126 set $link "privacy";
127 set $anchor "#abp_issue_reporter";
128 }
129 if ($arg_link = "contribute")
130 {
131 set $link "contribute";
132 }
133 if ($arg_link = "donate")
134 {
135 set $link "donate";
136 }
137 if ($arg_link = "acceptable_ads")
138 {
139 set $link "acceptable-ads";
140 }
141 if ($arg_link = "acceptable_ads_criteria")
142 {
143 set $link "acceptable-ads";
144 set $anchor "#criteria";
145 }
146 if ($arg_link = "contributors")
147 {
148 set $link "contributors";
149 }
150
151 if ($link = "")
152 {
153 return 404;
154 }
155
156 if ($arg_lang ~ ^(\w+))
157 {
158 set $lang $1;
159 }
160 if (!-f "$document_root/$lang/$link")
161 {
162 set $lang "!!";
163 }
164 set $langtest "$arg_lang $lang";
165 if ($langtest ~ "^(\w+)-(\w+) !!")
166 {
167 set $lang "$1_$2";
168 }
169 if (!-f "$document_root/$lang/$link")
170 {
171 set $lang "en";
172 }
173 if ($link = "share")
174 {
175 rewrite ^ https://share.adblockplus.org/$lang/? redirect;
Wladimir Palant 2015/04/15 12:26:54 While this works right now, the approach will have
176 }
177 rewrite ^ /$lang/$link$anchor? redirect;
178 }
179
180 location /devbuilds
181 {
182 rewrite ^(.*) https://downloads.adblockplus.org$1;
183 }
184
185 # Locations still served by the legacy server
186
187 location ~ ^(/blog|/releases|/development-builds|/atom|/rss|/category|/section|/ author|/file_download|/textpattern|/default-static|/_override-static)($|/)
188 {
189 try_files $uri @proxied;
190 }
191 location /forum
192 {
193 try_files $uri @proxied;
194 }
195 location /subscriptions.xml
196 {
197 try_files $uri @proxied;
198 }
199 location /subscriptions2.xml
200 {
201 try_files $uri @proxied;
202 }
203 location /subscriptionStatus
204 {
205 try_files $uri @proxied;
206 }
207 location /jsdoc
208 {
209 try_files $uri @proxied;
210 }
211 location /403.html
212 {
213 try_files $uri @proxied;
214 }
215 location @proxied
216 {
217 proxy_pass https://server_16.adblockplus.org;
218 proxy_set_header Host adblockplus.org;
219 proxy_redirect https://adblockplus.org/ https://$host/;
220 }
OLDNEW

Powered by Google App Engine
This is Rietveld