Accept-Encoding Header

Table of Content

The Accept-Encoding request HTTP header is used by the client or user agent to tell the server what compression algorithms it understands and in what order it prefers them. Content-Encoding, a corresponding field in HTTP responses, specifies the compression algorithm used on the data sent by the server. The primary purpose is to allow a document to be compressed without losing the identity of its underlying media type.

Syntax

Accept-Encoding: <coding>
Accept-Encoding: *
Accept-Encoding: compress, gzip
Accept-Encoding: 
Accept-Encoding: identity
Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1

Directives

  1. <coding>: Each coding value denotes an available and supported compression method. These could be gzip, compress, deflate, br, identity, etc.
  2. *: The asterisk character '*' matches all available content-codings done by the server.

Examples

For instance, to demonstrate that a client can support all types of encodings, but prefers br (Brotli) and gzip respectively:

Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Accept-Encoding header

ModHeader is a Chrome extension that allows users to modify HTTP headers on the fly. It can specifically modify the Accept-Encoding header to help test how the server responds to different types of encoding.

  1. Install ModHeader from the Chrome Web Store.
  2. Click on the ModHeader icon in the toolbar to open the extension.
  3. In the 'Filter' tab, enter the URL of the site you want to modify the headers for.
  4. Click on the 'Headers' tab.
  5. In the 'Request Headers' section, click on 'Add'.
  6. Enter 'Accept-Encoding' in the 'Name' field.
  7. Enter the value of the Accept-Encoding you want to test in the 'Value' field, for instance: gzip, deflate, br, etc.
  8. Navigate to the site in your browser. ModHeader will modify the Accept-Encoding header for every request to that site. This can be particularly useful to test how the server handles different compression methods and for optimizing website performance.