User:Pawel Krawczyk/List of useful HTTP headers

< User:Pawel Krawczyk
Revision as of 13:52, 14 January 2013 by Pawel Krawczyk (talk | contribs) (border)

Jump to: navigation, search

This page lists useful security-related HTTP headers. In most web application frameworks HTTP headers can be set in web server configuration, without changing actual application's code. This is often significantly faster and cheaper solution for at least partial mitigation of existing issues, and a quick additional layer of defense for new applications.

Field name Description Example
Strict-Transport-Security: max-age=16070400; includeSubDomains Complying user agents are to interact with this server using only secure HTTP connections (HTTP over TLS/SSL). HSTS is an IETF standards track protocol and is specified in RFC 6797. Strict-Transport-Security: max-age=16070400; includeSubDomains
X-Frame-Options<ref>IE8 Security Part VII: ClickJacking Defenses</ref> Clickjacking protection. Values: deny - no rendering within a frame, sameorigin - no rendering if origin mismatch, allow-from URL - allow rendering frame if loaded from URL X-Frame-Options: deny
X-XSS-Protection<ref>IE8 Security Part IV: The XSS Filter</ref> Cross-site scripting (XSS) filter X-XSS-Protection: 1; mode=block
X-Content-Type-Options<ref>{{Security Part VI: Beta 2 Update</ref> The only defined value, "nosniff", prevents Internet Explorer and Google Chrom from MIME-sniffing a response away from the declared content-type. This also applies to Google Chrome, when downloading extensions.<ref>{[url= - Google Chrome Extensions - Google Code]</ref> X-Content-Type-Options: nosniff
title=Content Security Policy ]</ref> Content Security Policy definition. Requires careful tuning and precise definition of the policy. If enabled CSP has significant impact on the way browser renders pages (e.g. inline JavaScript disabled by default and must be explicitly allowed in policy). X-WebKit-CSP: default-src 'self'

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:


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://*
  http://* https://* http://* *
  * * ** **
  'unsafe-inline' 'unsafe-eval' https://* http://*;
  style-src * 'unsafe-inline'; connect-src https://* http://*
  https://* http://* * **
  https://* ws://** http://*;
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 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