You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/support/Speed/Optimization - File Size/What will Cloudflare compress.md
+29-25Lines changed: 29 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ title: What will Cloudflare compress
6
6
7
7
# What will Cloudflare compress?
8
8
9
+
Cloudflare supports content compression both when delivering content to your website visitors and when requesting content from your origin server.
9
10
11
+
## Content compression from the Cloudflare network to website visitors
10
12
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.
12
14
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:
16
16
17
17
```
18
18
text/html
@@ -34,8 +34,8 @@ application/x-httpd-cgi
34
34
text/xml
35
35
application/xml
36
36
application/xml+rss
37
-
application/vnd.api+json
38
-
application/x-protobuf
37
+
application/vnd.api+json
38
+
application/x-protobuf
39
39
application/json
40
40
multipart/bag
41
41
multipart/mixed
@@ -57,38 +57,42 @@ application/eot
57
57
application/font
58
58
application/font-sfnt
59
59
application/wasm
60
-
application/javascript-binast
61
-
application/manifest+json
60
+
application/javascript-binast
61
+
application/manifest+json
62
62
application/ld+json
63
63
application/graphql+json
64
64
application/geo+json
65
65
```
66
66
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
68
72
69
-
___
73
+
By default, Brotli compression is enabled for domain on Free and Pro plans and disabled for domains on Business and Enterprise plans.
70
74
71
-
## Does Cloudflare compress resources?
75
+
To enable Brotli compression:
72
76
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**.
74
80
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
+
---
76
82
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
78
84
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.
80
86
81
-
{{<Asidetype="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:
84
88
85
-
___
89
+
* You include a `Content-Encoding` header in your server response mentioning gzip compression.
90
+
* The client supports the compression algorithm.
86
91
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.
88
93
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.
90
95
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
+
{{<Asidetype="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.
0 commit comments