百度智能云

All Product Document

          CDN

          Set the Page Compression

          Method Path Description
          PUT /v2/domain/{domain}/config?compress Set whether to enable page compression
          Interface description
          • domain: Acceleration domain name needing to set CDN.
          • Comments: The domain name enables page compression by default.
          • When page compression is enabled.

            • If Accept-Encoding is of ‘gzip type, it only takes effect for pages of ‘text/plain application/x-javascript text/css application/xml text/javascript text/html text/xml application/javascript type.
            • If Accept-Encoding is of a br type, it will be valid for the page type of text/plain application/x-javascript text/css application/xml text/javascript text/html text/xml application/javascript image/svg+xml application/json text/json;only,

          Request body

          Parameter Optional Type Description
          compress Required Json Detailed configuration of page compression
          allow Required Bool true means enabling page compression, and false means disabling page compression.
          type Required String The value is "br" or "gzip" or "all", which represents to support br and gzip respectively and both br and gzip as well

          Request example

          PUT /v2/domain/myself.baidu.com/config?compress HTTP/1.1 
          Host: cdn.baidubce.com 
          Content-Length: 72
          Content-Type: text/json;utf-8
          
          { 
              "compress": 
              { 
                  "allow":true, 
                  "type":"br" 
              } 
          } 

          Response code (Http Status Code)

          HTTP Status Code Description
          200 Success
          400 Update failures, parameter errors, etc.

          Response body

          Parameter Type Description
          status String The status returned after it was just updated successfully is OPERATING.

          Response example

          HTTP/1.1 200 OK 
          Server: nginx/1.14.0 
          Date: Fri, 21 Sep 2018 03:46:35 GMT 
          Content-Type: application/json; charset=utf-8 
          Transfer-Encoding: chunked 
          Connection: keep-alive 
          X-Powered-By: PHP/5.6.36x-bce-request-id: dd490e5d-64da-e2b-1cdd-fc98c864dfd 
          
          {"status":"OPERATING"} 
          Previous
          Query the Page Optimization
          Next
          Query the Page Compression