javaspring-boothttphttprequestcontent-encoding

Ordering of multiple values in content-encoding header in http request


I am getting request header 'content-encoding : gzip, br' in a http request so it is having multiple values in content-encoding header. Is the order of these values telling me the order in which compression was done on the request body or is it telling the order in which we need to apply decompression to decompress the request body? Can anyone please suggest?


Solution

  • From RFC 9110:

    If one or more encodings have been applied to a representation, the sender that applied the encodings MUST generate a Content-Encoding header field that lists the content codings in the order in which they were applied.

    In other words, you need to decode in the reverse order to the order in the header.