1

The MDN web docs Content-Encoding page says that the x-gzip token is an alias for gzip in the Content-Encoding http header.

But the accept-encoding page doesn't mention it.

Is there a list of headers by browser versions or system versions that uses x-gzip ? Where does this alias come from ?

Is using x-gzip in Accept-Encoding legit ?

1

It's legitimate (well, it used to be legitimate) in both usage and specification.

x- is a common prefix for nonstandard (or "not yet standard") identifiers, often explicitly allowed by protocols, often a de facto convention by implementers.

So x-gzip used to be widespread in HTTP/1.0 and originally meant that the format didn't yet have the name entered into the official Table Of Content Encodings maintained by IANA (if the table even existed back then). For example, Opera 4 or 5 used to send this token.

The gzip token was made standard since HTTP/1.1, and indeed the HTTP/1.1 specification says that x-gzip is an acceptable alias for compatibility purposes – it's certainly not something MDN just made up.

However, the big downside of this convention is that once the name gets standardized, the old x- version still sticks around for decades and software have to support both. Often newly written documentation will intentionally omit the old aliases to discourage their use. See also RFC 6648, which discusses the history and even mentions this exact token in Appendix B.

  • Thanks for your answer. These rfc links are useful and interesting. Are you sure that it is legit in accept-encoding, not only in content-encoding (does a source mention it ?). I can't find common browsers versions that send it, only crawlers and bots. – NanoPish May 29 '18 at 11:51
  • 1
    All x- tokens are "legit" in the sense that the protocol allows them. And if a given encoding is legit in reply's Content-Encoding, that implies it's legit in the request's Accept-Encoding as well (because the server can't use an encoding that the client didn't ask for!) Common browsers no longer send x-gzip – it's a relic of distant past. (see last edit). – grawity May 29 '18 at 11:55
  • 1
    If you want to be specific, see RFC 2616 or RFC 7231 and note that HTTP does not directly define the values of either of those headers – instead it defines a group of "content-coding" tokens, and the syntax definitions of both headers simply reference "content-coding". The primary source of allowed tokens is the IANA registry, while tables in MDN &c. are secondary sources. – grawity May 29 '18 at 11:59
  • 1
    Correction: I think I was wrong in saying that HTTP explicitly allows x-... tokens (although there are many other protocols which do). However, it does allow x-gzip specifically. – grawity May 29 '18 at 12:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.