---
title: Use only Brotli compression for a specific path · Cloudflare Rules docs
description: Create a compression rule to set Brotli as the only supported compression algorithm for a specific URI path.
lastUpdated: 2025-04-02T13:25:58.000Z
source_url:
  html: https://77937b5f.preview.developers.cloudflare.com/rules/compression-rules/examples/only-brotli-url-path/index.md
  md: https://77937b5f.preview.developers.cloudflare.com/rules/compression-rules/examples/only-brotli-url-path/
---

* Dashboard

  The following example rule will configure only Brotli compression for a specific URI path.

  **When incoming requests match**

  * Custom filter expression:

    * *URI Path* *equals* `/download/assets.tar`

  **Then**

  * **Compression options**: Custom
  * **Define a custom order for compression types**: `Brotli`

  Since the rule configuration does not include *Auto* at the end of the custom algorithms list, the response will be uncompressed if the web visitor does not support Brotli.

* API

  The following example sets the rules of an existing [entry point ruleset](https://developers.cloudflare.com/ruleset-engine/about/rulesets/#entry-point-ruleset) (with ID `{ruleset_id}`) for the `http_response_compression` phase to a single compression rule, using the [Update a zone ruleset](https://developers.cloudflare.com/api/resources/rulesets/methods/update/) operation:

  ```bash
  curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$RULESET_ID" \
    --request PUT \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    --json '{
      "rules": [
          {
              "expression": "http.request.uri.path eq \"/download/assets.tar\"",
              "action": "compress_response",
              "action_parameters": {
                  "algorithms": [
                      {
                          "name": "brotli"
                      }
                  ]
              }
          }
      ]
    }'
  ```
