Skip to content

Commit f26cf37

Browse files
authored
[Support] Update "What will Cloudflare compress" (#9199)
1 parent c479f63 commit f26cf37

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

content/support/Speed/Optimization - File Size/What will Cloudflare compress.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ title: What will Cloudflare compress
66

77
# What will Cloudflare compress?
88

9+
Cloudflare supports content compression both when delivering content to your website visitors and when requesting content from your origin server.
910

11+
## Content compression from the Cloudflare network to website visitors
1012

11-
In addition to Cloudflare's [CDN](/cache/) [caching static content](/cache/concepts/default-cache-behavior/) and [auto-minification](https://support.cloudflare.com/hc/en-us/articles/200168196-How-do-I-minify-HTML-CSS-and-JavaScript-to-optimize-my-site-) of CSS, JS & HTML to speed up your site, Cloudflare also provides gzip and brotli compression to help site owners. 
13+
In addition to Cloudflare's [CDN](/cache/) [caching static content](/cache/concepts/default-cache-behavior/) and [auto-minifying](/support/speed/optimization-file-size/using-cloudflare-auto-minify/) CSS, JavaScript, and HTML content to speed up your site, Cloudflare supports gzip and Brotli compression when delivering content to website visitors.
1214

13-
For responses with error status codes, Cloudflare will only compress responses if their error status code is `403` or `404`. For successful response status codes, Cloudflare will only compress responses if their status code is `200`. Responses with other status codes will not be compressed.
14-
15-
Cloudflare will return gzip or brotli encoded responses to compatible clients / browsers for the following content-types:
15+
If supported by visitors' web browsers, Cloudflare will return gzip or Brotli-encoded responses for the following content types:
1616

1717
```
1818
text/html
@@ -34,8 +34,8 @@ application/x-httpd-cgi
3434
text/xml
3535
application/xml
3636
application/xml+rss
37-
application/vnd.api+json
38-
application/x-protobuf
37+
application/vnd.api+json
38+
application/x-protobuf
3939
application/json
4040
multipart/bag
4141
multipart/mixed
@@ -57,38 +57,42 @@ application/eot
5757
application/font
5858
application/font-sfnt
5959
application/wasm
60-
application/javascript-binast
61-
application/manifest+json
60+
application/javascript-binast
61+
application/manifest+json
6262
application/ld+json
6363
application/graphql+json
6464
application/geo+json
6565
```
6666

67-
If you do not want a particular response from your origin to be encoded, you can disable this by setting `cache-control: no-transform` at your origin web server.
67+
Cloudflare's global network can deliver content to website visitors using gzip compression, [Brotli compression](#enable-brotli-compression), or no compression, according to the values visitors provide in the `Accept-Encoding` request header.
68+
69+
For responses with error status codes, Cloudflare will only compress responses if their error status code is `403` or `404`. For successful response status codes, Cloudflare will only compress responses if their status code is `200`. Responses with other status codes will not be compressed.
70+
71+
### Enable Brotli compression
6872

69-
___
73+
By default, Brotli compression is enabled for domain on Free and Pro plans and disabled for domains on Business and Enterprise plans.
7074

71-
## Does Cloudflare compress resources?
75+
To enable Brotli compression:
7276

73-
Yes, Cloudflare applies **gzip** and **brotli** compression to some types of content. We also gzip items based on the browser's UserAgent to help speed up page loading time.
77+
1. [Log in to the Cloudflare dashboard](https://dash.cloudflare.com/), and select your account and website.
78+
2. Go to **Speed** > **Optimization**.
79+
3. For **Brotli**, toggle the switch to **On**.
7480

75-
If you're already using gzip we will honor your gzip settings as long as you're passing the details in a header from your web server for the files.
81+
---
7682

77-
Cloudflare only supports the content types **gzip** towards your origin server and can also only deliver content either **gzip compressed****brotli compressed**, or **not compressed**.
83+
## Content compression from origin servers to the Cloudflare network
7884

79-
Cloudflare's reverse proxy is also able to convert between compressed formats and uncompressed formats, meaning that it can pull content from a customer's origin server via gzip and serve it to clients uncompressed (or vice versa). This is done independently of caching.
85+
When requesting content from your origin server, Cloudflare currently supports gzip compression or no compression.
8086

81-
{{<Aside type="warning">}}
82-
The `Accept-Encoding` header is not respected between Cloudflare and the origin, and will be removed.
83-
{{</Aside>}}
87+
If your origin server responds to a Cloudflare request using gzip compression, we will keep the same compression in the response sent to the website visitor if:
8488

85-
___
89+
* You include a `Content-Encoding` header in your server response mentioning gzip compression.
90+
* The client supports the compression algorithm.
8691

87-
## Enable Brotli compression
92+
Cloudflare's reverse proxy can also convert between compressed formats and uncompressed formats. Cloudflare can receive content from your origin server with gzip compression and serve it to visitors uncompressed (or vice versa), independently of caching.
8893

89-
By default, Brotli is enabled for domain on Free and Pro plans and disabled for domains on Business and Enterprise plans.
94+
If you do not want a particular response from your origin to be encoded with gzip/Brotli when delivered to website visitors, you can disable this by including a `cache-control: no-transform` HTTP header in the response from your origin web server.
9095

91-
1. [Log in to the Cloudflare dashboard](https://dash.cloudflare.com/), and select your account and website.
92-
2. Click the **Speed** app.
93-
3. Click the **Optimization** tab.
94-
4. Toggle the Brotli switch to **On**.
96+
{{<Aside type="warning" header="Warning">}}
97+
Cloudflare will take into consideration the `Accept-Encoding` header value in website visitors' requests when sending responses to those visitors. However, when requesting content from your origin server, Cloudflare will send a different `Accept-Encoding` header, supporting only gzip compression.
98+
{{</Aside>}}

0 commit comments

Comments
 (0)