Forum Moderators: phranque
HTTPS Security Headers
[edited by: phranque at 12:57 pm (utc) on May 13, 2020]
[edit reason] disable graphic smile faces [/edit]
We are dedicated to transparency in our operations and in the certificates we issue. We submit all certificates to Certificate Transparency logs as we issue them. You can view all issued Let’s Encrypt certificates via these links:[letsencrypt.org...]
Header set Content-Security-Policy "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self';"
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header set X-Robots-Tag "notranslate, noarchive"
Header set X-Frame-Options "deny"
Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
Header set Referrer-Policy "no-referrer"
Header set Expect-CT "max-age=0; report-uri=https://example.com/ct/reportOnly"
Note: exact syntax would depend on server config
Header set X-XSS-Protection "1; mode=block"
if you have third-party adverts or other content then add those sources specifically and explicitly to CSP.
Browser Support[scotthelme.co.uk...]
Fortunately, support for the CSP header is widespread but there is one thing to watch out for, good old Internet Explorer. The Content-Security-Policy header is supported in the latest and greatest versions of Chrome, FireFox, Safari (OSX and iOS), Opera (but not Mini), the Android Browser and Chrome for Android. Internet Explorer, however, requires the X-Content-Security-Policy header instead. This means that if you want to have the most widespread support for your CSP header, you will need to issue it twice! I have to admit I'm not a great fan of that prospect but hopefully that will change in IE 12.
@glitterball - Every site will be different. Use the examples found lower on the page at this link: [scotthelme.co.uk...]
Header set Content-Security-Policy "script-src 'self' https://apis.google.com"However, exact syntax will depend on your server config. If you use a redirect (example to www or HTTP to HTTPS) you may need you use your full domain path "https://www.example.com" instead of "self"