HTTP headers | Accept-Encoding

The HTTP headers Accepts-Encoding is usually a comparison algorithm of request header. All the HTTP client used to tell the server which encoding or encoding it supports. Then the server will respond in any of the supporting encoding formats. The server selects any one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header.

Syntax:

Accept-Encoding: gzip | compress | deflate | br| identity| *

Note: Multiple algorithm are also can be applicable.

Directives:

  • gzip: It is a compression format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC.
  • compress: It is a compression format using the Lempel-Ziv-Welch (LZW) algorithm.
  • deflate: It is a compression format using the zlib structure, with the deflate compression algorithm.
  • br: It is a compression format using the Brotli algorithm.
  • identity: This directive Indicates the identity function which is always acceptable.
  • *: This directive matches any content encoding which can be listed in the header or not. It is the default value.

You can check how good your Accept-Encoding and Content-Encoding is working on this site.
Example:

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

To check this Accept-Encoding in action go to Inspect Element -> Network check the request header for Accept-Encoding like below, Accept-Encoding is highlighted you can see.

Supported Browsers: The browsers compatible with HTTP headers Accept-Encoding are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.