| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 <% include_file = lambda do |url| %> | 1 <% include_file = lambda do |url| %> |
| 2 <% content = Puppet::FileServing::Content.indirection.find(url) %> | 2 <% content = Puppet::FileServing::Content.indirection.find(url) %> |
| 3 <% if content %> | 3 <% if content %> |
| 4 <%= content.content %> | 4 <%= content.content %> |
| 5 <% else %> | 5 <% else %> |
| 6 <% raise StandardError, "Failed to resolve source URL #{url}" %> | 6 <% raise StandardError, "Failed to resolve source URL #{url}" %> |
| 7 <% end %> | 7 <% end %> |
| 8 <% end %> | 8 <% end %> |
| 9 | 9 |
| 10 <% server_name = lambda do |domain, alt_names| %><%= domain %><% @alt_names.each do |name| %>, <%= name %><% end %><% end %> | 10 <% server_name = lambda do |domain, alt_names| %><%= domain %><% @alt_names.each do |name| %>, <%= name %><% end %><% end %> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 location / | 29 location / |
| 30 { | 30 { |
| 31 rewrite (.*) https://$host$1 permanent; | 31 rewrite (.*) https://$host$1 permanent; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 server | 34 server |
| 35 { | 35 { |
| 36 server_name <% server_name[domain, alt_names] %>; | 36 server_name <% server_name[domain, alt_names] %>; |
| 37 | 37 |
| 38 <% if is_default %> | 38 <% if is_default %> |
| 39 listen 443 ssl spdy default_server; | 39 listen 443 ssl http2 default_server; |
| 40 listen [::]:443 ssl spdy default_server; | 40 listen [::]:443 ssl http2 default_server; |
| 41 <% else %> | 41 <% else %> |
| 42 listen 443 ssl spdy; | 42 listen 443 ssl http2; |
| 43 listen [::]:443 ssl spdy; | 43 listen [::]:443 ssl http2; |
| 44 <% end %> | 44 <% end %> |
| 45 | 45 |
| 46 ssl_certificate <%= certificate %>; | 46 ssl_certificate <%= certificate %>; |
| 47 ssl_certificate_key <%= private_key %>; | 47 ssl_certificate_key <%= private_key %>; |
| 48 | 48 |
| 49 add_header Strict-Transport-Security max-age=31536000; | 49 add_header Strict-Transport-Security max-age=31536000; |
| 50 <% else %> | 50 <% else %> |
| 51 server | 51 server |
| 52 { | 52 { |
| 53 server_name <% server_name[domain, alt_names] %>; | 53 server_name <% server_name[domain, alt_names] %>; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 64 access_log /var/log/nginx/<%= log %> <%= log_format %>; | 64 access_log /var/log/nginx/<%= log %> <%= log_format %>; |
| 65 | 65 |
| 66 # redirect server error pages to the static page /50x.html | 66 # redirect server error pages to the static page /50x.html |
| 67 # | 67 # |
| 68 error_page 500 502 503 504 /50x.html; | 68 error_page 500 502 503 504 /50x.html; |
| 69 location = /50x.html | 69 location = /50x.html |
| 70 { | 70 { |
| 71 root /usr/share/nginx/html; | 71 root /usr/share/nginx/html; |
| 72 } | 72 } |
| 73 | 73 |
| 74 if ($http_host ~ "\.$") { | 74 if ($http_host ~ "^(.+)\.$") |
|
Wladimir Palant
2016/05/24 19:08:07
Nit: The opening bracket belong on the next line.
| |
| 75 rewrite ^(.*) $scheme://$host$1 permanent; | 75 { |
|
Wladimir Palant
2016/05/24 19:08:07
This relies on undocumented behavior, namely $host
| |
| 76 set $canonical_host $1; | |
| 77 rewrite ^(.*) $scheme://$canonical_host$1 permanent; | |
| 76 } | 78 } |
| 77 | 79 |
| 78 <% if @content %> | 80 <% if @content %> |
| 79 <%= content %> | 81 <%= content %> |
| 80 <% end %> | 82 <% end %> |
| 81 | 83 |
| 82 <% if @source %> | 84 <% if @source %> |
| 83 <% include_file[source] %> | 85 <% include_file[source] %> |
| 84 <% end %> | 86 <% end %> |
| 85 } | 87 } |
| LEFT | RIGHT |