Add Netlify header control to improve CouldFlare caching behavior (#10628)

* Add Netlify header control to improve CouldFlare caching behavior

* Add security headers

* Add old school cache busting to Jekyll css/js

* Add a little browser cache to assets to improve speed of pages
This commit is contained in:
Franck Nijhof 2019-10-07 18:54:55 +02:00 committed by GitHub
parent 0ee25497da
commit 083351b990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View File

@ -134,5 +134,6 @@ defaults:
# Support for files Jekyll will normally exclude
include:
- ".well-known"
- "_headers"
- "_redirects"
- ".well-known"

20
source/_headers Normal file
View File

@ -0,0 +1,20 @@
/*
Cache-Control: public, max-age: 0, s-max-age=3600, must-revalidate
Content-Security-Policy: form-action https:
Feature-Policy: vibrate 'none'; geolocation 'none'; midi 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; vibrate 'none'; payment 'none'
Referrer-Policy: strict-origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
/*.css
Cache-Control: public, max-age: 604800, s-max-age=604800
/*.js
Cache-Control: public, max-age: 604800, s-max-age=604800
/assets/*
Cache-Control: public, max-age: 0, s-max-age=604800, must-revalidate
/fonts/*
Cache-Control: public, max-age: 1800, s-max-age=604800, must-revalidate
/images/*
Cache-Control: public, max-age: 1800, s-max-age=604800, must-revalidate
/static/*
Cache-Control: public, max-age: 1800, s-max-age=604800, must-revalidate

View File

@ -5,7 +5,7 @@ g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<script type="text/javascript" src="/javascripts/prism.js"></script>
<script src="/javascripts/prism.js?{{ site.time | date: '%s' }}" type="text/javascript"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>

View File

@ -28,8 +28,8 @@
<meta name="twitter:description" content="{{ page.description | default: site.description | strip_html | truncate: 200 }}">
<meta name="twitter:image" content="{{ page.og_image | default: "/images/default-social.png" | prepend: site.url }}">
<link href="/stylesheets/prism.css" rel="stylesheet">
<link href="/stylesheets/screen.css" media="screen, projection, print" rel="stylesheet">
<link href="/stylesheets/prism.css?{{ site.time | date: '%s' }}" rel="stylesheet">
<link href="/stylesheets/screen.css?{{ site.time | date: '%s' }}" media="screen, projection, print" rel="stylesheet">
<link href="{{ site.subscribe_rss }}" rel="alternate" title="{{ site.title }}" type="application/atom+xml">
<link rel='shortcut icon' href='/images/favicon.ico' />
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />