http-headersAccept-Encoding: (Request)


Introduction

Accept-Encoding tells the server what encoding the client accepts. Encoding is mostly used for compression.

Syntax

  • Accept-Encoding: Encoding;QualityFactor
  • Accept-Encoding: Encoding;QualityFactor, type;QualityFactor, type;QualityFactor, ...

Parameters

ParameterDescription
EncodingThe type of encoding to use. This can also be a * to say the client has no preference to what encoding to use
QualityFactorThe quality factor in the format ;q=0.8. If this is set to 0 then it means "not acceptable". (optional)

Remarks

Accept-Encoding takes a number of encoding and includes an optional preference for which one the server should use. The encoding is one from the list of available encodings at IANA registry. For example gzip.

The encoding is separated by commas with an optional quality factor (using a ;q=) that is used the clients preference for using this encoding. The quality factor has a value from 0 to 1 with the higher the number the more preference for that encoding.

If this header is not included then the client does not state any preference for the encoding. It does not mean that the client supports all encodings.

A value of identity is always acceptable unless you reject it with identity;q=0.

The server uses Content-Encoding to inform the client what encoding it is using.

If the server can't find an acceptable charset to reply with then it should send a 406 (not acceptable) response or ignore this header and not doing any content negotiation.