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

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

Issue 29474653: Remove trailing slashes from file URLs in web::server class (Closed)
Patch Set: Created June 26, 2017, 8:17 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 %>
(...skipping 28 matching lines...) Expand all
39 if (-e "$document_root/en$uri") 39 if (-e "$document_root/en$uri")
40 { 40 {
41 rewrite ^(.*) /en$1 last; 41 rewrite ^(.*) /en$1 last;
42 } 42 }
43 43
44 # Redirect server/language root 44 # Redirect server/language root
45 45
46 rewrite ^/$ /$index_page last; 46 rewrite ^/$ /$index_page last;
47 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; 47 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent;
48 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; 48 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last;
49
50 # Remove accidental trailing slash
51
52 if (!-d "$document_root/$uri")
Wladimir Palant 2017/06/26 22:20:47 You probably want to do this only for actual files
mathias 2017/06/27 10:04:01 In fact i wanted to explicitly express that this i
53 {
54 rewrite ^(/.*)/$ $1 redirect;
Wladimir Palant 2017/06/26 22:20:47 In the case we are talking about (something that w
mathias 2017/06/27 10:04:01 Acknowledged.
55 }
49 } 56 }
50 57
51 <% if @multiplexer_locations %> 58 <% if @multiplexer_locations %>
52 <% @multiplexer_locations.each do |location| %> 59 <% @multiplexer_locations.each do |location| %>
53 location <%= location %> 60 location <%= location %>
54 { 61 {
55 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; 62 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock;
56 include /etc/nginx/fastcgi_params; 63 include /etc/nginx/fastcgi_params;
57 } 64 }
58 <% end %> 65 <% end %>
59 <% end %> 66 <% 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