|
91 | 91 |
|
92 | 92 | rewrite_log <%= ENV.fetch("REWRITE_LOG", 'off') %>; |
93 | 93 |
|
| 94 | + add_header_inherit merge; |
| 95 | + |
94 | 96 | server { |
95 | 97 | listen <%= ENV.fetch("PORT") %> default_server; |
96 | 98 | server_name <%= primary_host %> localhost; |
@@ -210,10 +212,14 @@ http { |
210 | 212 | server_name regional.rubykaigi.org; |
211 | 213 |
|
212 | 214 | set $csp_policy ""; |
| 215 | + set $csp_policy_report ""; |
213 | 216 | if ($http_x_forwarded_proto = "https") { |
214 | | - set $csp_policy "default-src https: 'self' 'unsafe-inline' 'unsafe-eval'; report-uri https://<%= primary_host %>/_csp"; |
| 217 | + set $csp_policy "upgrade-insecure-requests; frame-ancestors 'none'; default-src https:"; |
| 218 | + set $csp_policy_report "default-src https:; report-uri https://<%= primary_host %>/_csp"; |
215 | 219 | } |
216 | | - add_header Content-Security-Policy-Report-Only "$csp_policy"; |
| 220 | + add_header X-Content-Type-Options "nosniff"; |
| 221 | + add_header Content-Security-Policy "$csp_policy"; |
| 222 | + add_header Content-Security-Policy-Report-Only "$csp_policy_report"; |
217 | 223 |
|
218 | 224 | location ~ ^/oedo02(.*) { |
219 | 225 | return 301 https://magazine.rubyist.net/articles/0039/0039-MetPragdaveAtAsakusarb.html; |
@@ -495,21 +501,28 @@ http { |
495 | 501 | server_name rubykaigi.org; |
496 | 502 |
|
497 | 503 | set $csp_policy ""; |
| 504 | + set $csp_policy_report ""; |
498 | 505 | if ($http_x_forwarded_proto = "https") { |
499 | | - set $csp_policy "default-src https: 'self' 'unsafe-inline' 'unsafe-eval'; report-uri https://<%= primary_host %>/_csp"; |
| 506 | + set $csp_policy "frame-ancestors 'none'; default-src https:"; |
| 507 | + set $csp_policy_report "default-src https:; report-uri https://<%= primary_host %>/_csp"; |
500 | 508 | } |
501 | | - add_header Content-Security-Policy-Report-Only "$csp_policy"; |
| 509 | + add_header X-Content-Type-Options "nosniff"; |
| 510 | + add_header Strict-Transport-Security "max-age=31536000"; |
| 511 | + add_header Content-Security-Policy "$csp_policy"; |
| 512 | + add_header Content-Security-Policy-Report-Only "$csp_policy_report"; |
502 | 513 |
|
503 | | - location ~ ^/200[6-9] { |
| 514 | + location ~ ^/20(0[6-9]|1[0-5])(.*) { |
504 | 515 | include force_https.conf; |
505 | 516 | include github_pages.conf; |
506 | 517 | proxy_hide_header Cache-Control; |
507 | 518 | proxy_hide_header Expires; |
| 519 | + # 2015 sites and prior had mixed content issues |
| 520 | + set $csp_policy "upgrade-insecure-requests; frame-ancestors 'none'; default-src https:"; |
508 | 521 | add_header Cache-Control "public, max-age=604800, s-maxage=31536000"; |
509 | 522 | proxy_pass https://2009-2011.rubykaigi.org; |
510 | 523 | } |
511 | 524 |
|
512 | | - location ~ ^/201[0-9](.*) { |
| 525 | + location ~ ^/201[6-9](.*) { |
513 | 526 | include force_https.conf; |
514 | 527 | include github_pages.conf; |
515 | 528 | proxy_hide_header Cache-Control; |
|
0 commit comments