Re: [whatwg] APIs to interrogate default outgoing HTTP headers, i.e. Accept-Encoding

On Tue, 11 Aug 2015 at 08:31 Nils Dagsson Moskopp <
nils@dieweltistgarnichtso.net> wrote:

> I do not understand that use case. It reads incredibly convoluted to
> me. The UA controls the transport anyway – it should not make any
> practical difference to a script how the data is transmitted.
>
My use case is centred around trying to optimise network usage when
requesting content from AWS CloudFront backed by S3.

I 100% agree with you that this should not be a script's problem. However,
it is. When the server (CloudFront in this case) has raw and GZIP'ed copies
of content, and no automatic server-side selection between the two, the
only way to optimise network usage is for the script to make this
determination.

Unfortunately, there is no way to gain access to the default Accept
Encoding header from JavaScript, which is necessary to figure out whether
to download raw of GZIP'ed content.

So we currently do more hoop-jumping by serving a dynamic initial HTML,
where the server constructing it can reflect the UA's Accept Encoding
header back to the client in a generated script tag. It's yucky.

Beyond our own need for access to the Accept Encoding header, there may be
other use cases that are supported by providing access to other headers.


> Btw, why can AWS CloudFront not into compressed content?
>
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
> CloudFront doesn't compress the files itself
> Amazon S3 doesn't compress files automatically
AWS CloudFront will "do the right thing" if it is backed by a Custom Origin
that honours the Accept Encoding header (not S3).
We have repeatedly requested improvements from AWS, and they are likely on
the way, but we have many hoops to jump until then.

When last I checked, many sites using AWS CloudFront and S3, including the
first-party AWS Console itself, do not serve GZIP'ed resources, which is
sub-optimal.


> --
> Nils Dagsson Moskopp // erlehmann
> <http://dieweltistgarnichtso.net>
>

Received on Monday, 10 August 2015 22:44:02 UTC