Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,10 @@
/support/speed/optimization-delivery/configuring-cloudflare-mirage/ /speed/optimization/images/mirage/ 301
/support/speed/optimization-mobile/understanding-cloudflare-mobile-redirect/ /speed/optimization/other/mobile-redirect/ 301
/support/speed/optimization-file-size/using-cloudflare-auto-minify/ /speed/optimization/content/ 301
/support/speed/optimization-file-size/what-will-cloudflare-compress/ /speed/optimization/content/brotli/ 301
/support/speed/optimization-file-size/what-will-cloudflare-compress/ /speed/optimization/content/compression/ 301
/speed/optimization/content/brotli/ /speed/optimization/content/compression/ 301
/speed/optimization/content/brotli/enable/ /speed/optimization/content/compression/ 301
/speed/optimization/content/brotli/content-compression/ /speed/optimization/content/compression/ 301
/support/speed/optimization-file-size/why-isnt-auto-minify-working/ /speed/optimization/content/troubleshooting/ 301
/support/speed/optimization-mobile/why-is-the-mobile-redirect-i-set-up-through-cloudflare-redirecting-my-static-assets/ /speed/optimization/other/troubleshooting/mobile-redirect-affect-static-assets/ 301
/speed/optimization/other/amp-real-ulr/ /speed/optimization/other/amp-real-url/ 301
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/cache/concepts/cache-control.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The `stale-if-error` directive is ignored if [Always Online](/cache/how-to/alway
Additional directives that influence cache behavior are listed below.

* `no-transform` — Indicates that an intermediary — regardless of whether it implements a cache — must not transform the payload.
* `vary` — Cloudflare does not consider vary values in caching decisions. Nevertheless, vary values are respected when [Vary for images](/cache/advanced-configuration/vary-for-images/) is configured and when the vary header is [`vary: accept-encoding`](/speed/optimization/content/brotli/).
* `vary` — Cloudflare does not consider vary values in caching decisions. Nevertheless, vary values are respected when [Vary for images](/cache/advanced-configuration/vary-for-images/) is configured and when the vary header is [`vary: accept-encoding`](/speed/optimization/content/compression/).
* `immutable` — Indicates to clients the response body does not change over time. The resource, if unexpired, is unchanged on the server. The user should not send a conditional revalidation request, such as `If-None-Match` or `If-Modified-Since`, to check for updates, even when the user explicitly refreshes the page. This directive has no effect on public caches like Cloudflare, but does change browser behavior.

## Enable Origin Cache Control
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/cache/reference/etag-headers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Weak ETag headers indicate a cached resource is semantically equivalent to the v
:::note


When using weak ETag headers, it is necessary to disable certain features such as [Email Obfuscation](/waf/tools/scrape-shield/email-address-obfuscation/) and [Automatic HTTPS Rewrites](/ssl/edge-certificates/additional-options/automatic-https-rewrites/) to prevent Cloudflare from removing the ETag headers set by your origin web server. For a comprehensive list of the features you need to disable, refer to the [Notes about end-to-end compression](/speed/optimization/content/brotli/content-compression/#notes-about-end-to-end-compression).
When using weak ETag headers, it is necessary to disable certain features such as [Email Obfuscation](/waf/tools/scrape-shield/email-address-obfuscation/) and [Automatic HTTPS Rewrites](/ssl/edge-certificates/additional-options/automatic-https-rewrites/) to prevent Cloudflare from removing the ETag headers set by your origin web server. For a comprehensive list of the features you need to disable, refer to the [Notes about end-to-end compression](/speed/optimization/content/compression/#notes-about-end-to-end-compression).


:::
Expand All @@ -30,7 +30,7 @@ When you enable **Respect Strong ETags** in a cache rule, Cloudflare will use st
However, in some situations Cloudflare will convert strong ETags to weak ETags. For example, given the following conditions:

* **Respect Strong ETags** is enabled
* [Brotli compression](/speed/optimization/content/brotli/) is enabled
* [Brotli compression](/speed/optimization/content/compression/) is enabled
* The origin server's response includes an `etag: "foobar"` strong ETag header

The Cloudflare network will take the following actions, depending on the visitor's `accept-encoding` header and the compression used in the origin server's response:
Expand Down Expand Up @@ -60,7 +60,7 @@ When **Respect Strong ETags** is disabled, Cloudflare will preserve strong ETag
In all other situations, Cloudflare will either convert strong ETag headers to weak ETag headers or remove the strong ETag. For example, given the following conditions:

* **Respect Strong ETags** is disabled
* [Brotli compression](/speed/optimization/content/brotli/) is enabled
* [Brotli compression](/speed/optimization/content/compression/) is enabled
* The origin server's response includes an `etag: "foobar"` strong ETag header

The Cloudflare network will take the following actions, depending on the visitor's `accept-encoding` header and the compression used in the origin server's response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Cloudflare also supports the older [Pages](https://nextjs.org/docs/pages) router
- N/A: Not applicable
```

[^1]: **compression**: [Cloudflare applies gzip or brotli compression](/speed/optimization/content/brotli/) automatically. When developing locally with Wrangler, no compression is applied.
[^1]: **compression**: [Cloudflare applies Brotli or Gzip compression](/speed/optimization/content/compression/) automatically. When developing locally with Wrangler, no compression is applied.

[^2]: **dev indicators**: If you're developing using `wrangler pages dev`, it hard refreshes your application the dev indicator doesn't appear. If you run your app locally using `next dev`, this option works fine.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ head:
2. Go to **Rules** > **Compression Rules**.
3. To create a new empty rule, select **Create rule**. To duplicate an existing rule, select the three dots next to it > **Duplicate**.
4. Enter a descriptive name for the rule in **Rule name**.
5. Under **When incoming requests match**, select if you wish to apply the rule to [default content types](/speed/optimization/content/brotli/content-compression/#compression-between-cloudflare-and-website-visitors) (content types that Cloudflare compresses by default), or to requests that match a custom filter expression.
5. Under **When incoming requests match**, select if you wish to apply the rule to [default content types](/speed/optimization/content/compression/#compression-between-cloudflare-and-website-visitors) (content types that Cloudflare compresses by default), or to requests that match a custom filter expression.
6. (Optional) To define a custom expression, use the Expression Builder (specifying one or more values for **Field**, **Operator**, and **Value**) or manually enter an expression using the Expression Editor. For more information, refer to [Edit rule expressions](/ruleset-engine/rules-language/expressions/edit-expressions/).
7. Under **Compression options**, set the [compression options](/rules/compression-rules/settings/#dashboard-configuration-settings).
8. To save and deploy your rule, select **Deploy**. If you are not ready to deploy your rule, select **Save as Draft**.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Example, TabItem, Tabs } from "~/components";

<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">

The following example rule will turn on Zstandard compression for response content types where [Cloudflare applies compression by default](/speed/optimization/content/brotli/content-compression/). If the client does not support Zstandard compression, it will use Brotli or Gzip compression as a fallback.
The following example rule will turn on Zstandard compression for response content types where [Cloudflare applies compression by default](/speed/optimization/content/compression/). If the client does not support Zstandard compression, it will use Brotli or Gzip compression as a fallback.

<Example>

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/rules/compression-rules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FeatureTable, Render } from "~/components";

Use Compression Rules to customize the compression applied to responses from Cloudflare's global network to your website visitors, based on the file extension and content type. Compression Rules are powered by the [Ruleset Engine](/ruleset-engine/).

Cloudflare [compresses some responses by default](/speed/optimization/content/brotli/), based on the content type. With Compression Rules, you can customize the default behavior, which includes defining preferred compression algorithms for particular file types.
Cloudflare [compresses some responses by default](/speed/optimization/content/compression/), based on the content type. With Compression Rules, you can customize the default behavior, which includes defining preferred compression algorithms for particular file types.

When there is a match for a compression rule configured with several compression algorithms, the selected algorithm is the first one supported by the website visitor, according to the received `accept-encoding` HTTP header. If multiple compression rules match, the last rule wins.

Expand Down
10 changes: 5 additions & 5 deletions src/content/docs/rules/compression-rules/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Enables Cloudflare's default compression setting. Brotli is the preferred compre

### Disable compression

Disables compression for matching requests. Also disables Cloudflare's [default compression behavior](/speed/optimization/content/brotli/content-compression/).
Disables compression for matching requests. Also disables Cloudflare's [default compression behavior](/speed/optimization/content/compression/).

### Custom

Expand All @@ -36,12 +36,12 @@ Allowed values are the following:
- **Brotli**: Use the Brotli compression algorithm, if supported by the website visitor.
- **Zstandard**: Use the Zstandard (Zstd) compression algorithm, if supported by the website visitor.
- **Auto**: Compress the response according to the algorithms supported by the website visitor (if any). Cloudflare will define the order of preference for the compression algorithms, which may change in the future. Has the same behavior of the **Enable compression** option.
- **Default**: Use Cloudflare's [default compression behavior](/speed/optimization/content/brotli/), which depends on the response content type.
- **Default**: Use Cloudflare's [default compression behavior](/speed/optimization/content/compression/), which depends on the response content type.

If you specify only _Gzip_, _Brotli_, or _Zstandard_ and no algorithm matches, the response will have no compression. To configure a fallback compression mechanism, add _Auto_ to the list.

:::note
The compression applied by the _Default_ option takes into account global configuration settings such as [Enable Brotli compression](/speed/optimization/content/brotli/).
The compression applied by the _Default_ option takes into account global configuration settings such as [Enable Brotli compression](/speed/optimization/content/compression/).
:::

---
Expand Down Expand Up @@ -69,14 +69,14 @@ The supported algorithm values are:
- `zstd`: Use the Zstandard compression algorithm, if supported by the website visitor.
- `none`: Do not use any compression algorithm.
- `auto`: Compress the response according to the algorithms supported by the website visitor (if any). Cloudflare will define the order of preference for the compression algorithms, which may change in the future.
- `default`: Use Cloudflare's [default compression behavior](/speed/optimization/content/brotli/content-compression/#compression-between-cloudflare-and-website-visitors), which depends on the response content type.
- `default`: Use Cloudflare's [default compression behavior](/speed/optimization/content/compression/#compression-between-cloudflare-and-website-visitors), which depends on the response content type.

If you include `none`, `default`, or `auto` in the list, it must be the last value in the list.

When you specify only the `gzip`, `brotli`, or `zstd` algorithms, if no algorithm matches then the response will have no compression. To configure a fallback compression mechanism, add `auto` to the list.

:::note
The compression applied by the `default` algorithm takes into account global configuration settings such as [Enable Brotli compression](/speed/optimization/content/brotli/).
The compression applied by the `default` algorithm takes into account global configuration settings such as [Enable Brotli compression](/speed/optimization/content/compression/).
:::

For API examples, refer to the [Examples gallery](/rules/compression-rules/examples/).
31 changes: 0 additions & 31 deletions src/content/docs/speed/optimization/content/brotli/enable.mdx

This file was deleted.

20 changes: 0 additions & 20 deletions src/content/docs/speed/optimization/content/brotli/index.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ application/geo+json
Cloudflare's global network can deliver content to website visitors using Gzip compression, Brotli compression, Zstandard compression, or no compression, depending on:

- The values visitors provide in the `accept-encoding` request header.
- The value of the [Brotli setting](/speed/optimization/content/brotli/) at the zone level.
- The value of the [Brotli setting](/speed/optimization/content/compression/) at the zone level.
- Any configured [compression rule](/rules/compression-rules/) that matches incoming requests.

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.
Expand Down Expand Up @@ -154,3 +154,17 @@ Cloudflare will take into consideration the `accept-encoding` header value in we
---

<Render file="brotli-compression-warning" />

## Compression methods by plan

### Between visitors and Cloudflare

By default, Cloudflare uses the following compression methods for content delivery, depending on the zone plan. However, the actual compression applied may also depend on what the visitor's browser requests via the `accept-encoding` header.

- Free Plan: Content is compressed by default using Zstandard.
- Pro and Business Plans: Content is compressed by default using Brotli.
- Enterprise Plan: Content is compressed by default using Gzip.

### Between Cloudflare and the origin server

On all plans, Cloudflare requests content from the origin server using the `accept-encoding: br, gzip` header. This means that Cloudflare asks the origin to send the content compressed using Brotli or Gzip, depending on which method the origin server supports.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ Make sure that the field values are respecting the following requirements: [RFC

* A compression issue, for example the origin server is serving gzip encoded compressed content but is not updating the `content-length` header, or the origin is serving broken gzip compressed content.

**Resolution**: In this case you can try to disable compression at your origin and rely on Cloudflare to [compress content](/speed/optimization/content/brotli/content-compression/)
**Resolution**: In this case you can try to disable compression at your origin and rely on Cloudflare to [compress content](/speed/optimization/content/compression/)
You can also investigate the configuration of your origin server to make sure the compression is working as expected.
2 changes: 1 addition & 1 deletion src/content/plans/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@
},
"brotli": {
"title": "Brotli compression",
"link": "/speed/optimization/content/brotli/",
"link": "/speed/optimization/content/compression/",
"properties": {
"availability": {
"title": "Availability",
Expand Down
Loading