Questions tagged [http-accept-encoding]

The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings (section 3.5) that are acceptable in the response.

The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response.

   Accept-Encoding  = "Accept-Encoding" ":"
                      1#( codings [ ";" "q" "=" qvalue ] )
   codings          = ( content-coding | "*" )

Examples of its use are:

   Accept-Encoding: compress, gzip
   Accept-Encoding:
   Accept-Encoding: *
   Accept-Encoding: compress;q=0.5, gzip;q=1.0
   Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0

A server tests whether a content-coding is acceptable, according to an Accept-Encoding field, using these rules:

  1. If the content-coding is one of the content-codings listed in the Accept-Encoding field, then it is acceptable, unless it is accompanied by a qvalue of 0. (As defined in section 3.9, a qvalue of 0 means "not acceptable.")
  2. The special "*" symbol in an Accept-Encoding field matches any available content-coding not explicitly listed in the header field.
  3. If multiple content-codings are acceptable, then the acceptable content-coding with the highest non-zero qvalue is preferred.
  4. The "identity" content-coding is always acceptable, unless specifically refused because the Accept-Encoding field includes "identity;q=0", or because the field includes "*;q=0" and does not explicitly include the "identity" content-coding. If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable.

If an Accept-Encoding field is present in a request, and if the server cannot send a response which is acceptable according to the Accept-Encoding header, then the server SHOULD send an error response with the 406 (Not Acceptable) status code.

If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content coding. In this case, if "identity" is one of the available content-codings, then the server SHOULD use the "identity" content-coding, unless it has additional information that a different content-coding is meaningful to the client.

Note: If the request does not include an Accept-Encoding field, and if the "identity" content-coding is unavailable, then content-codings commonly understood by HTTP/1.0 clients (i.e., "gzip" and "compress") are preferred; some older clients improperly display messages sent with other content-codings.
The server might also make this decision based on information about the particular user-agent or client.

Note: Most HTTP/1.0 applications do not recognize or obey qvalues associated with content-codings. This means that qvalues will not work and are not permitted with x-gzip or x-compress.

31 questions
1
vote
1 answer

Why does http.sys (before IIS) return badrequest when requests have certain acceptable accept-encoding header values?

Given a web app (netcoreapp3.0 hosted in IIS) -- any requests with certain values for Accept-Encoding header never gets to the application. http.sys parses and spits out a 400 - BadRequest. i.e., Accept-Encoding: application/gzip,gzip The issue…
1
vote
2 answers

Why is the browser making multiple requests to the page URL?

Here is a page from my website. When browsers, such as Firefox and Safari load this page, they are requesting the same document multiple times. See the screenshot from developer tool below. For the 3 lines pointed above, browser requests and…
1
vote
1 answer

How to add "Vary: Accept-Encoding" header in yaws to cacheable files

I was testing my website for optimization and I got this recommendation: The following publicly cacheable, compressible resources should have a "Vary: Accept-Encoding" header: So, How do I add Vary: Accept-Encoding header using an embedded yaws to…
user4672604
1
vote
1 answer

Error in Accept-Encoding header in jdk 1.8.0_91

I am making a POST call. The call is working on one system (say system1) and not working on the other system (say system2). I am getting following error: [2016-08-15 20:22:43.242] [qtp2024542466-14] [ERROR] [c.a.b.e.m.AbstractExceptionMapper] [Error…
Abhishek Gupta
  • 6,465
  • 10
  • 50
  • 82
1
vote
0 answers

difference between gzip and gzip, deflate

I want to know what is the difference when I add Accept-Encoding: gzip, deflate in request header and when I only add Accept-Encoding: gzip. Because in response header I could see Content-Encoding : gzip only every time and the compression…
1
vote
1 answer

AWS Cloudfront Missing Accept-Encoding Header

I have done compression on my origin server for static content. But when I request any content I am not getting compress content. Response Header should show accept-encoding. Below I pasted my Request and Response Header Response…
1
vote
1 answer

How to set up caching and compression correctly in Joomla

I'm developing Joomla websites and I've just been running some page speed tests at http://tools.pingdom.com/. It gives me a zero score for browser caching. I have caching already enabled in Joomla global configuration. Is there something else I…
geochanto
  • 972
  • 2
  • 13
  • 45
1
vote
2 answers

Where is defined the according type for the JSON output in Zend Framework 2?

I activated the JsonStrategy in a ZF2 application and can get JSON output now using AcceptableViewModelSelector Controller Plugin. It works only with the HTTP Request parameter Accept containing application/json. Where is application/json defined as…
automatix
  • 14,018
  • 26
  • 105
  • 230
0
votes
0 answers

Is there a way to get, with JavaScript, the list of "Accept-Encoding"?

I've a use case where I need to get files from a CDN but I need to know what encodings does the browser support in order to append the right file extension on the files to get. Is there a way to query the DOM or the browser about its support of…
Eugene
  • 217
  • 8
  • 24
0
votes
1 answer

Haproxy seemingly substitutes brotli with gzip in "Accept-Encoding" header

Im struggling to figure out why haproxy seemingly replaces br with gzip in "Accept-Encoding" header as request passes haproxy. My application currently structured like this: HAPROXY(tls termination) -> varnish -> apache So I test like this: curl…
Dannyboy
  • 1,963
  • 3
  • 20
  • 37
0
votes
1 answer

Http Server not returning content-encoding header in response

I'm making http request using HttpWebRequest client HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestString); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; request.Method = "GET";…
Karen Avdalyan
  • 382
  • 1
  • 20
0
votes
1 answer

How to check browser's support for brotli compression on client application side?

I am asking this question for educational purposes. I have hosted my static assets on S3 with Cloud front. I want to apply brotli and gzip compression during the build process. As per articles available on various platforms It is possible to add…
Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
0
votes
1 answer

SimpleJSON returns null when handling a call from Postmen

I've installed into my unity SimpleJSON in attempt to deserialize the received call from REST-HTTP call that hold a JSON simpleJSON that's my script im listening to localhost 3000 and sending from postman GET HTTP/1.1 Host: localhost:3000 Accept:…
0
votes
1 answer

how can I download Google Drive file in compressed format in c#

I am trying to improve performance for my application by downloading google drive files in compressed format. I am using this as reference. https://developers.google.com/drive/api/v2/performance#gzip I tried various things in the header of the …
0
votes
2 answers

Does */* in an HTTP Accepts-Encoding Header Mean Gzip is Supported?

I'm trying to serve up some JS and CSS files from Amazon CloudFront using Gzip. Following their instructions, it seems that I'm supposed to determine if the client supports Gzip when rendering my page, and if so, I append .gz to the file URL. The…
Josh Pearce
  • 3,399
  • 1
  • 23
  • 24