Table of Content
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.
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
<coding>: Each coding value denotes an available and supported compression method. These could be
*: The asterisk character '*' matches all available content-codings done by the server.
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
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.
- Install ModHeader from the Chrome Web Store.
- Click on the ModHeader icon in the toolbar to open the extension.
- In the 'Filter' tab, enter the URL of the site you want to modify the headers for.
- Click on the 'Headers' tab.
- In the 'Request Headers' section, click on 'Add'.
- Enter 'Accept-Encoding' in the 'Name' field.
- Enter the value of the Accept-Encoding you want to test in the 'Value' field, for instance:
- Navigate to the site in your browser. ModHeader will modify the
Accept-Encodingheader 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.