Skip to content

Deprecate middleware auth gating across Next.js reference and guides#3405

Open
jacekradko wants to merge 1 commit into
jacek/deprecate-createroutematcher-foundationfrom
jacek/deprecate-createroutematcher-nextjs
Open

Deprecate middleware auth gating across Next.js reference and guides#3405
jacekradko wants to merge 1 commit into
jacek/deprecate-createroutematcher-foundationfrom
jacek/deprecate-createroutematcher-nextjs

Conversation

@jacekradko
Copy link
Copy Markdown
Member

Stacked on #3404. Applies the deprecation across the Next.js reference and the guides that taught middleware gating.

The reference page is kept-but-wrapped: each auth-gating section keeps its existing anchor but gains the deprecation notice, token-type gating now points to auth({ acceptsToken }) at the route, and the Combine-Middleware example loses its auth.protect() line. In the guides, basic-rbac now leads with the page-level check, session-tasks elevates <RedirectToTasks />, geo-blocking and satellite-domains keep their middleware but drop the auth tail, the custom sign-in/up steps are framed as legacy, the CSP examples drop the auth gating that was never relevant to CSP, and the MCP guide stops special-casing .well-known.

Load-bearing bit to scrutinize: every surviving createRouteMatcher example moves from /foo(.*) to /foo/:path*. The (.*) form misses encoded newlines (a bypass) and over-matches /foobar; /:path* fixes both. Verified against the SDK's path-to-regexp.

Wraps the auth-gating sections of the Next.js clerkMiddleware reference with the deprecation notice (keeping anchors and clerkMiddleware config intact), redirects token-type gating to auth({ acceptsToken }) at the route, and points readers to resource-level protection. Updates the guides that taught the pattern: basic-rbac now leads with page-level checks, session-tasks elevates <RedirectToTasks />, geo-blocking and satellite-domains keep their middleware but drop the auth tail, the custom sign-in/up steps are framed as legacy, CSP examples drop the irrelevant auth gating, and the MCP guide no longer special-cases .well-known. All surviving createRouteMatcher examples use the newline-safe :path* form instead of (.*).
@jacekradko jacekradko requested a review from a team as a code owner May 29, 2026 21:26
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-docs Ready Ready Preview May 29, 2026 9:27pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant