mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
docs: clarify that proxy/middleware matches static assets by default (#92441)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ### What? Adds an explicit note about Proxy's default matching behavior at the top of the **Matcher** section in the Proxy API reference — the first place users look when configuring which paths Proxy runs on. ### Why? Users have reported issues where Tailwind styles and other static assets fail to load because their Proxy auth logic intercepts `_next/static` requests and redirects them (see #92435). The existing docs mention that Proxy runs on "every route" but don't explicitly call out static assets, image optimizations, or public folder files — making this a common pitfall that gets misdiagnosed as a CSS/PostCSS problem. ### How? Added an inline paragraph at the top of the **Matcher** subsection explaining that without a `matcher`, Proxy matches every request — including `_next/static`, `_next/image`, and `public/` files — and that this can break asset loading. Links to the existing Negative matching section. Fixes #92435 <!-- NEXT_JS_LLM_PR --> <!-- CURSOR_AGENT_PR_BODY_END --> [Slack Thread](https://vercel.slack.com/archives/C0AA1U29GQ0/p1775539745696779?thread_ts=1775539745.696779&cid=C0AA1U29GQ0) <div><a href="https://cursor.com/agents/bc-263e5d8f-e356-5e3a-a247-856d00a78af4"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-263e5d8f-e356-5e3a-a247-856d00a78af4"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Joseph <[email protected]>
This commit is contained in:
co-authored by
Cursor Agent
Joseph
parent
621c73a247
commit
b9a14768a2
@@ -70,7 +70,11 @@ Optionally, a config object can be exported alongside the Proxy function. This o
|
||||
|
||||
### Matcher
|
||||
|
||||
The `matcher` option allows you to target specific paths for the Proxy to run on. You can specify these paths in several ways:
|
||||
The `matcher` option allows you to target specific paths for the Proxy to run on.
|
||||
|
||||
Without a `matcher`, Proxy runs on **every request**, including static files (`_next/static`), image optimizations (`_next/image`), and assets in the `public/` folder. Consider using a [negative match pattern](#negative-matching) to exclude these paths, otherwise auth logic or redirects can unintentionally block CSS, JS, or images from loading.
|
||||
|
||||
You can specify paths in several ways:
|
||||
|
||||
- For a single path: Directly use a string to define the path, like `'/about'`.
|
||||
- For multiple paths: Use an array to list multiple paths, such as `matcher: ['/about', '/contact']`, which applies the Proxy to both `/about` and `/contact`.
|
||||
|
||||
Reference in New Issue
Block a user