how to enable google cdn dynamic compression?

477 views Asked by At

Google's documentation mentions that cdn can enable dynamic compression, and an example is provided below, but I can't successfully set the dynamic compression strategy

document

document link

The error I see when I execute the command is as follows, is it changed to other flags?And from the log, the size of the transferred image is not compressed.

error

2

There are 2 answers

2
elving On BEST ANSWER

It looks like there are two problems. First, you appear to have an old version of gcloud that was released prior to the dynamic compression Beta. The right way to upgrade gcloud will depend on your platform, but it's typically gcloud components update or sudo apt-get upgrade google-cloud-sdk.

Once you have an up-to-date gcloud installation, you'll likely run into the second problem. Google's documentation incorrectly advises you to use gcloud compute, but you need to use gcloud beta compute while the feature remains in Beta:

$ gcloud compute backend-services update YOUR_BACKEND_SERVICE_NAME --compression-mode=AUTOMATIC ERROR: (gcloud.compute.backend-services.update) unrecognized arguments:

 --compression-mode flag is available in one or more alternate release tracks. Try:

  gcloud alpha compute backend-services update --compression-mode
  gcloud beta compute backend-services update --compression-mode

  --compression-mode=AUTOMATIC (did you mean '--custom-response-header'?)
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
$
0
Dave On

You can now enable Dynamic Compression from within the UX. Under the Backend Service/Bucket.

Enable Dynamic Compression

You may need to purge the old content in order for the new compressed content to be served. Cloud CDN will not evict a valid object just because you changed the configuration.