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

Side by Side Diff: modules/adblockplusorg/files/adblockplus.org

Issue 9170066: Don't use firefox as the default user agent (Closed)
Patch Set: Created Jan. 10, 2013, 4:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 server { 1 server {
2 root /var/www/adblockplus.org/httpdocs; 2 root /var/www/adblockplus.org/httpdocs;
3 3
4 location / { 4 location / {
5 index index.php index index.html; 5 index index.php index index.html;
6 6
7 if ($arg_a = "view") { 7 if ($arg_a = "view") {
8 rewrite ^(.*) $1? permanent; 8 rewrite ^(.*) $1? permanent;
9 } 9 }
10 10
11 set $preferredLang en; 11 set $preferredLang en;
12 if ($http_accept_language ~ ^(\w\w)\b) { 12 if ($http_accept_language ~ ^(\w\w)\b) {
13 set $preferredLang $1; 13 set $preferredLang $1;
14 } 14 }
15 if (!-f $document_root/static/$preferredLang/index) { 15 if (!-f $document_root/static/$preferredLang/index) {
16 set $preferredLang en; 16 set $preferredLang en;
17 } 17 }
18 18
19 set $user_agent "firefox"; 19 set $user_agent "";
20 if ($http_user_agent ~ \bGecko/\d+) {
21 set $user_agent "firefox";
22 }
20 if ($http_user_agent ~ \bChrome/\d+) { 23 if ($http_user_agent ~ \bChrome/\d+) {
21 set $user_agent "chrome"; 24 set $user_agent "chrome";
22 } 25 }
23 if ($http_user_agent ~ \bPresto/\d+) { 26 if ($http_user_agent ~ \bPresto/\d+) {
24 set $user_agent "opera"; 27 set $user_agent "opera";
25 } 28 }
26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) { 29 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
27 set $user_agent "android"; 30 set $user_agent "android";
28 } 31 }
29 32
33 set $platform "firefox";
34 if ($user_agent) {
35 set $platform $user_agent;
36 }
37
30 if ($arg_a ~ ^(view|show)?$) { 38 if ($arg_a ~ ^(view|show)?$) {
31 rewrite ^/(index\.html)?$ /$preferredLang/$user_agent redirect; 39 rewrite ^/(index\.html)?$ /$preferredLang/$platform redirect;
32 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$user_agent redirect; 40 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$platform redirect;
33 } 41 }
34 42
35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; 43 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
36 rewrite ^/anwiki/(.*) /$1 permanent; 44 rewrite ^/anwiki/(.*) /$1 permanent;
37 45
38 if (-f $request_filename) { 46 if (-f $request_filename) {
39 break; 47 break;
40 } 48 }
41 if (-d $request_filename) { 49 if (-d $request_filename) {
42 break; 50 break;
43 } 51 }
44 52
45 set $static_uri $uri; 53 set $static_uri $uri;
46 set $platform $user_agent;
47 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) { 54 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) {
48 set $static_uri "/$1/"; 55 set $static_uri "/$1/";
49 set $platform $3; 56 set $platform $3;
50 } 57 }
51 set $static ""; 58 set $static "";
52 if (-f "$document_root/static$static_uri") { 59 if (-f "$document_root/static$static_uri") {
53 set $static "ok"; 60 set $static "ok";
54 } 61 }
55 if (-d "$document_root/static$static_uri") { 62 if (-d "$document_root/static$static_uri") {
56 set $static "ok"; 63 set $static "ok";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 fastcgi_param GATEWAY_INTERFACE CGI/1.1; 116 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
110 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 117 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
111 118
112 fastcgi_param REMOTE_ADDR $remote_addr; 119 fastcgi_param REMOTE_ADDR $remote_addr;
113 fastcgi_param REMOTE_PORT $remote_port; 120 fastcgi_param REMOTE_PORT $remote_port;
114 fastcgi_param SERVER_ADDR $server_addr; 121 fastcgi_param SERVER_ADDR $server_addr;
115 fastcgi_param SERVER_PORT $server_port; 122 fastcgi_param SERVER_PORT $server_port;
116 fastcgi_param SERVER_NAME $server_name; 123 fastcgi_param SERVER_NAME $server_name;
117 } 124 }
118 } 125 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld