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

Side by Side Diff: modules/web/templates/site.conf.erb

Issue 29487668: Issue 5402 - Extract language and region from ?fb_locale (Closed)
Patch Set: Created July 12, 2017, 3:39 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
« 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 root /var/www/<%= @vhost %>; 1 root /var/www/<%= @vhost %>;
2 index index; 2 index index;
3 default_type text/html; 3 default_type text/html;
4 charset utf-8; 4 charset utf-8;
5 5
6 set $index_page "index"; 6 set $index_page "index";
7 7
8 <% if @custom_config %> 8 <% if @custom_config %>
9 <%= @custom_config %> 9 <%= @custom_config %>
10 <% end %> 10 <% end %>
11 11
12 location / 12 location /
13 { 13 {
14 expires 1d; 14 expires 1d;
15 15
16 # Match Accept-Language header against available languages 16 # Match Accept-Language header against available languages
17 17
18 set $preferredLang en; 18 set $preferredLang en;
19 set $preferredRegion ""; 19 set $preferredRegion "";
20 if ($http_accept_language ~ ^(\w\w)\b) 20 if ($http_accept_language ~ ^(\w\w)\b)
21 { 21 {
22 set $preferredLang $1; 22 set $preferredLang $1;
23 } 23 }
24 if ($http_accept_language ~ ^\w\w-(\w\w)\b) 24 if ($http_accept_language ~ ^\w\w-(\w\w)\b)
25 { 25 {
26 set $preferredRegion $1; 26 set $preferredRegion $1;
27 } 27 }
28 28
29 if ($arg_fb_locale ~ ^(\w\w)_(\w\w)$)
30 {
31 set $preferredLang $1;
32 set $preferredRegion $2;
33 }
34
29 # Redirect canonical URLs to language-specific versions 35 # Redirect canonical URLs to language-specific versions
30 36
31 if (-e "$document_root/${preferredLang}_$preferredRegion$uri") 37 if (-e "$document_root/${preferredLang}_$preferredRegion$uri")
32 { 38 {
33 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; 39 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last;
34 } 40 }
35 if (-e "$document_root/$preferredLang$uri") 41 if (-e "$document_root/$preferredLang$uri")
36 { 42 {
37 rewrite ^(.*) /$preferredLang$1 last; 43 rewrite ^(.*) /$preferredLang$1 last;
38 } 44 }
(...skipping 11 matching lines...) Expand all
50 56
51 <% if @multiplexer_locations %> 57 <% if @multiplexer_locations %>
52 <% @multiplexer_locations.each do |location| %> 58 <% @multiplexer_locations.each do |location| %>
53 location <%= location %> 59 location <%= location %>
54 { 60 {
55 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; 61 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock;
56 include /etc/nginx/fastcgi_params; 62 include /etc/nginx/fastcgi_params;
57 } 63 }
58 <% end %> 64 <% end %>
59 <% end %> 65 <% end %>
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