How to document an HTTP header

The MDN HTTP header reference documents HTTP header fields are components of the header section of request and response messages in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction. This page explains how to create a new MDN reference page for an HTTP header.

Prerequisites

  • You will need an MDN account.
  • You will need to know or be able to dive into some HTTP.

Step 1 – find an HTTP header to document

Step 2 – look at existing header reference pages

  • Existing HTTP headers are documented here.
  • There are different header categories: Request header, Response header, and Representation header.
  • Find the category of the header you are about to document (note that some headers can be both request and response headers, depending on context).
  • Go to an existing header reference page that has the same category.

Step 3 – create a new page

Step 4 – write content

  • Either start from our template HTTP header page or use a copied structure from one of the existing HTTP header documents that you found in step 2. It's your choice.
  • Write about your new HTTP header.
  • Make sure you have these sections:
    • Introductory text where the first sentence mentions the header name (bold) and summarizes its purpose.
    • Information box containing at least the header type and if the header is a Forbidden header name.
    • A syntax box containing all possible directives/parameters/values of the HTTP header.
    • A section that explains these directives/values.
    • An example section that contains a practical use case for this header or shows where and how it occurs usually.
    • A specification section listing relevant RFC standard documents.
    • A "See also" section listing relevant resources.

Step 4a – add tags to the page

All HTTP header pages should at least have these tags: "HTTP", "Header", "Reference".

Step 5 – add browser compatibility information

  • If you have looked at other HTTP header pages, you will see that there is a {{compat}} macro that will fill in a browser table for you.
  • The compatibility table page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data/README.md and send us a pull request.

Step 6 – add the header to the HTTP header list

Step 7 – get a review

Once your page is created, submit it as a PR, and a member of our review team will be assigned automatically to review your page.