# Google Speed Test - Enable Compression

**URL:** https://meta.discourse.org/t/google-speed-test-enable-compression/77305
**Category:** Support
**Created:** [January 5, 2018, 11:20am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305 "2018-01-05T11:20:01Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### Post date: [January 5, 2018, 11:20am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/1 "2018-01-05T11:20:01Z")

</div>

I’m trying to tune my CDN for the site [https://discuss.endurancelab.fit](https://discuss.endurancelab.fit).

When I run a google speed test I’m getting a recommendation to Enable Compression of the following:

 ![44 AM](https://global.discourse-cdn.com/meta/original/3X/7/3/731282c9cfd83bc4a25006875777ff74e8df07de.png)

When I run that same test on [https://meta.discourse.org](https://meta.discourse.org) I get the following.

 ![56 AM](https://global.discourse-cdn.com/meta/original/3X/4/2/42594b8add9e09749161aa454015dfa2d2611ae0.png)

So [meta.discourse.org](http://meta.discourse.org) is compressing the files that my site is not. I’m using cloudfront for my CDN. Any thoughts on how to get these files compressed?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [January 5, 2018, 11:34am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/2 "2018-01-05T11:34:11Z")

</div>

That’s probably something you’d need to ask Cloudfront.

---

<div class="post-metadata">

### Author: ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### Post date: [January 5, 2018, 11:37am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/3 "2018-01-05T11:37:28Z")

</div>

OK - will do. In order to formulate my question to them, is there a header or some code that would indicate to the CDN to compress those files? Just want to make sure I’m specific in what I ask.

I suspect something is getting stripped or not read correctly and I’d like to indicate what that could be.

thx

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [January 5, 2018, 10:23pm UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/4 "2018-01-05T22:23:53Z")

</div>

It’s just the usual content encoding negotiation headers. Nothing special.

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [January 6, 2018, 11:22am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/5 "2018-01-06T11:22:45Z")

</div>

Your CDN is not compressing certain files that they should do by default.

Maybe there is a setting turning compression on or off. Make sure it is turned on. MOST CDNs also allow you to control compression by file type (i.e. MIME type) so things that are already compressed, like JPEG pictures, will not be compressed twice.

So you need to call up your CDN and say:

Hey, my files are not compressed (gripped in tech lingo). What should i do to turn on compression?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 6, 2018, 11:19pm UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/7 "2018-01-06T23:19:13Z")

</div>

The css file not being compressed is added to my list

Will get it sorted

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 9, 2018, 2:32am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/8 "2018-01-09T02:32:21Z")

</div>

This is some crazy banana level stuff:

> <https://stackoverflow.com/questions/33375304/what-are-the-options-for-the-gzip-proxied-directive-for/33448739#33448739>

I just enabled `gzip_proxied: any` in our template per:

[https://github.com/discourse/discourse/commit/18a929d801442643883531ea82c948c21d306e73](https://github.com/discourse/discourse/commit/18a929d801442643883531ea82c948c21d306e73)

NGINX _explicitly_ do not serve gzipped content to CDNs that send through a `Via` header (for dynamically compressed stuff)

The reason appears to be that:

> it is reasonable to compress responses only to requests that will not be cached on the proxy server

Now my guess here is that this is some sort of crazy scheme where they are

- Either trying to account for bad proxies sending bogus headers

- Or, are trying to save a handful of CPU cycles

Both reasons do not make sense to me so I am setting our template to something saner.

**EDIT** confirmed the fix, so closing.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 10, 2018, 7:00am UTC](https://meta.discourse.org/t/google-speed-test-enable-compression/77305/11 "2018-01-10T07:00:00Z")

</div>

This topic was automatically closed after 27 hours. New replies are no longer allowed.
