# excludePath not matching in netlify.toml for edge function

**URL:** <https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983>\
**Category:** Support\
**Tags:** edge\_functions\
**Created:** [November 23, 2025, 11:29am UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983 "2025-11-23T11:29:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryantownsend](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ryantownsend/32/68157_2.png) [@ryantownsend](https://answers.netlify.com/u/ryantownsend)\
**Post date:** [November 23, 2025, 11:29am UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983/1 "2025-11-23T11:29:50Z")

</div>

I’m using an edge function to rewrite HTML responses to pre-built DCZ-compressed versions ([ZSTD compression dictionaries](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Compression_dictionary_transport)), it’s all working except I can’t seem to negate functions using `excludePath` in the `netlify.toml` file [as per the documentation here](https://docs.netlify.com/build/edge-functions/declarations/#declare-edge-functions-in-netlifytoml).

My configuration is as follows:

```auto
[[edge_functions]]
  function = "compression-dictionary-rewrite"
  path = "/*"
  excludedPath = "/*.dcz"
  [edge_functions.header]
  accept = "text/html"
  accept-encoding = "dcz"
  available-dictionary = true
  dictionary-id = true

```

My function contains a log message that (if the config is working properly) should never be output:

```javascript
// we don't rewrite requests that are already for .dcz files
if (url.pathname.toLowerCase().endsWith(".dcz")) {
  console.log("Request is already for a .dcz file, skipping dictionary rewrite.");
  return;
}

```

But this is appearing in my logs (see last line below):

```auto
01KAPGEK info [compression-dictionary-rewrite] Compression Dictionary Rewrite Edge Function invoked for /
01KAPGEK info [compression-dictionary-rewrite] Rewriting / to /index.html-b133bf1c52766a9023afe70952fb0039.dcz
01KAPGEK info [compression-dictionary-rewrite] Compression Dictionary Rewrite Edge Function invoked for /index.html-b133bf1c52766a9023afe70952fb0039.dcz
01KAPGEK info [compression-dictionary-rewrite] Request is already for a .dcz file, skipping dictionary rewrite.

```

Is there some reason this isn’t working? I’ve tried testing the `excludedPath` with [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) (as per other threads on the forum) and it _should_ match, so those requests _should_ be ignored?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [November 24, 2025, 2:37pm UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983/2 "2025-11-24T14:37:09Z")

</div>

What site is this about? Also,

> [@ryantownsend](#):
>
> ```auto
> [edge_functions.header]
> accept = "text/html"
> accept-encoding = "dcz"
> available-dictionary = true
> dictionary-id = true
> 
> ```

is invalid config. Seems AI generated?

---

<div class="post-metadata">

**Author:** ![ryantownsend](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ryantownsend/32/68157_2.png) [@ryantownsend](https://answers.netlify.com/u/ryantownsend)\
**Post date:** [November 24, 2025, 3:05pm UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983/3 "2025-11-24T15:05:32Z")

</div>

This is the relevant site (link to branch preview):

> **[Lessons of a CTO](https://deploy-preview-17--lessonsofacto.netlify.app/)**
>
> Weekly actionable tips for developers, managers and leaders from seasoned CTO Ryan Townsend.

That config isn’t AI generated, [Netlify’s own documentation explains it here.](https://docs.netlify.com/build/edge-functions/declarations/#match-by-headers-1) It basically means I only match on requests based on:

- `Accept` header including the string `text/html`
- `Accept-Encoding` header including `dcz`
- `Available-Dictionary` header being present
- `Dictionary-ID` header being present

This is all to do with [compression dictionaries](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Compression_dictionary_transport).

---

<div class="post-metadata">

**Author:** ![ryantownsend](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ryantownsend/32/68157_2.png) [@ryantownsend](https://answers.netlify.com/u/ryantownsend)\
**Post date:** [December 1, 2025, 8:37am UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983/4 "2025-12-01T08:37:25Z")

</div>

@hrishikesh can I please get an update on this, is it being looked at? Let me know if I’m better submitting a support ticket, I just figured it would be better to discuss in the open incase others have the same problem in future.

---

<div class="post-metadata">

**Author:** ![ryantownsend](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/ryantownsend/32/68157_2.png) [@ryantownsend](https://answers.netlify.com/u/ryantownsend)\
**Post date:** [December 9, 2025, 7:38pm UTC](https://answers.netlify.com/t/excludepath-not-matching-in-netlify-toml-for-edge-function/157983/5 "2025-12-09T19:38:34Z")

</div>

If anyone else comes across this issue: I’ve been told by support that the config will only sync properly once the function has been deployed to production. They have taken note to update the documentation.

On the flip side, I’ve found that the config appears to be working properly when defined as a JavaScript export instead of within the `netlify.toml`, so that might be a workaround for others.
