List of useful HTTP headers

This page lists useful security-related HTTP headers. In most architectures these headers can be set in web server configuration (Apache, IIS, nginx), without changing actual application's code. This offers significantly faster and cheaper method for at least partial mitigation of existing issues, and an additional layer of defense for new applications.

Check Your Headers
Visit Check Your Headers to view and evaluate any website's security headers. http://cyh.herokuapp.com/cyh

For Chrome, the Recx Security Analyser extension checks a number of security relevant headers and gives a nice report on the findings. Recx Security Analyser

Real life examples
Below examples present selected HTTP headers as set by popular websites to demonstrate that they are indeed being used in production services:

Facebook
As of January 2013 Facebook main page was setting these security related HTTP headers.

Strict-Transport-Security: max-age=60 X-Content-Type-Options: nosniff X-Frame-Options: DENY X-WebKit-CSP: default-src *; script-src https://*.facebook.com http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* 'unsafe-inline' 'unsafe-eval' https://*.akamaihd.net http://*.akamaihd.net; style-src * 'unsafe-inline'; connect-src https://*.facebook.com http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net *.spotilocal.com:* https://*.akamaihd.net ws://*.facebook.com:* http://*.akamaihd.net; X-XSS-Protection: 1; mode=block

Especially interesting is Facebook's use of Content Security Policy (using Google Chrome syntax), whose implementation can be challenging for large sites with heavy usage of JavaScript.

As of July 2014, the following headers were set:

strict-transport-security: max-age=7776000 x-content-type-options: nosniff x-frame-options: DENY '''content-security-policy: default-src *;script-src https://*.facebook.com http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net https://*.fbcdn.net http://*.fbcdn.net *.facebook.net *.spotilocal.com:* https://*.akamaihd.net wss://*.facebook.com:* ws://*.facebook.com:* http://*.akamaihd.net https://fb.scanandcleanlocal.com:* *.atlassolutions.com http://attachment.fbsbx.com https://attachment.fbsbx.com; ''' x-xss-protection:0
 * .google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* 'unsafe-inline' 'unsafe-eval' https://*.akamaihd.net http://*.akamaihd.net
 * .atlassolutions.com chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl;style-src * 'unsafe-inline';connect-src https://*.facebook.com http://*.facebook.com

Google+
As of January 2013 Google+ main page was setting these security related HTTP headers:

x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-xss-protection: 1; mode=block

Twitter
As of May 2013 Twitter main page was setting these security related HTTP headers:

strict-transport-security: max-age=631138519 x-frame-options: SAMEORIGIN x-xss-protection: 1; mode=block

As of July 2014 we can see the implementation of CSP added: ''' content-security-policy-report-only: default-src https:; connect-src https:; font-src https: data:; frame-src https: http://*.twimg.com http://itunes.apple.com about: javascript:; img-src https: data:; media-src https:; object-src https:; script-src 'unsafe-inline' 'unsafe-eval' about: https:; style-src 'unsafe-inline' https:; report-uri https://twitter.com/i/csp_report?a=NVQWGBBBFVZXO2LAAA%3D%3D%3D%3D%3D%3D&ro=true; '''