Premchand Kannujiya
Premchand Kannujiya

Reputation: 11

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 Header

Accept-Ranges   bytes
Access-Control-Allow-Orig...    *
Age 66882
Cache-Control   max-age=86401,Public, private
Connection  keep-alive
Content-Length  672360
Content-Type    application/x-javascript
Date    Tue, 17 Feb 2015 12:51:03 GMT
Etag    "201:0"
Last-Modified   Tue, 10 Feb 2015 10:55:41 GMT
Server  Microsoft-IIS/7.5
Via 1.1 e5ac6dd.cloudfront.net (CloudFront)
X-Amz-Cf-Id fg_yEVDpepF4e0Uk_y0Z-aZ801X1aA==
X-Cache Hit from cloudfront

Request Header

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip
Accept-Language en-US,en;q=0.5
Cache-Control   no-cache
Connection  keep-alive
Host    d18m3f4yg8acci.cloudfront.net
Pragma  no-cache
User-Agent  Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0

Thanks Prmechand

Upvotes: 1

Views: 1510

Answers (1)

Mark Kelly
Mark Kelly

Reputation: 563

The problem your seeing is due to IIS dropping gzip compression due to the presence of a 'Via' header (it assumes not all proxies can cope with compressed content).

I've answered this question, and provided a fix here (although the asker hasn't got round to marking it as accepted).

Amazon EC2 serves gzipped JavaScript. But Cloudfront does not. Why?

Upvotes: 1

Related Questions