0

GCP Cloud CDN does not compress any responses when the strategy for compression is set to AUTOMATIC (as it should per the docs) (UI of the CDN in question).

No compression takes place, and no content-encoding header is sent, even tho an accept-encoding header (gzip, deflate, br) is sent.

A prime example of an ~300kb file not being compressed appropriately can be found behind a CDN here: https://himmer.software/main.6a971e1e28a0da9a.js (as of 30.11.2022). The object in question in the connected backend bucket: Object

I feel I must be overseeing something, the mime type and request headers are correct, so having the compression mode set to automatic should return a compressed version of the object.

I set compression mode to AUTOMATIC, set back to DISABLED and back to AUTOMATIC, ran v1.compute.urlMaps.invalidateCache with /* on the load balancer (invalidated all records AFAICT), but still nothing.

  • 1
    This is not an answer. If I want Cloud Storage objects compressed, I compress them before uploading. This saves space, reduces cost, and improves performance. Compression is a time expensive operation. Do it once instead of over and over. – John Hanley Dec 01 '22 at 00:26
  • 1
    Try changing **Cache mode** to "Cache static content" as a test. – John Hanley Dec 01 '22 at 00:35
  • That makes sense, I suppose you encode all files and set the `Content-Encoding` metadata via `gsutil` when uploading assets? Not that many target browsers would be lost, but forcing brotli would make the browser unable to decompress files, right? I probably will resort to this solution, but I would really like to understand why this does not work the way I think it should. I also tried changing the Cache mode back from Origin Settings, but this does nothing apparently. (https://i.imgur.com/3ngxPMX.png) – Clemens Himmer Dec 01 '22 at 13:47

2 Answers2

1

Are you using the new Google Global Load Balancer or the Classic Load Balancer? Dynamic compression is not currently supported on the new GCLB option, only the Classic GCLB at this time.

Dave
  • 434
  • 5
  • Thank you, that is actually what is causing the missing encoding! While I will be introducing compression before uploading as suggested by @John Hanley, it's good to know why this happened. Curious thing this isn't well documented (no mention in either documentations linked in GCP [[1](https://cloud.google.com/load-balancing/docs/https/traffic-management-global?_ga=2.126472719.-389910338.1665756544), [2](https://cloud.google.com/load-balancing/docs/https?hl=en_US)], probably somewhere deeper in those docs) tho, and that the associated resource (LB) rather than the CDN was causing this. – Clemens Himmer Dec 20 '22 at 14:55
  • I'd agree that the documentation on this is less than optimal. This will be less of an issue later in 2023 as the new load balancer feature set catches up to the Classic L7XLB feature set. – Dave Dec 20 '22 at 21:35
0

Dynamic compression is not currently supported on the new GCLB option

This is still valid and it just cost me 2 hours to find it out. Worst thing: When you create the loadbalancer via the CDN wizard, IT CREATES A NEW LOADBALANCER THAT DOES JUST SILENTLY NOT COMPRESS YOUR FILES. AHHHH!111

muffl0n
  • 3
  • 1
  • 3