Skip to content

fix: add documentation for chaining proxy/middleware - #784

Open
pesickaa wants to merge 4 commits into
mainfrom
fix/add-nextjs-middleware-chaining
Open

fix: add documentation for chaining proxy/middleware#784
pesickaa wants to merge 4 commits into
mainfrom
fix/add-nextjs-middleware-chaining

Conversation

@pesickaa

@pesickaa pesickaa commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description (required)

Add documentation to help users who are struggling with chaining multiple proxy/middleware

Related issues & labels (optional)

Summary by CodeRabbit

  • Documentation
    • Updated the Next.js SDK documentation metadata and summary.
    • Added guidance for combining authentication handling with custom middleware.
    • Documented authenticated responses, session-cookie propagation, public routes, and next-intl integration.

@pesickaa pesickaa self-assigned this Aug 3, 2026
@pesickaa
pesickaa requested a review from a team as a code owner August 3, 2026 13:00
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tamalchowdhury, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 08a60fe3-4a5b-4150-998c-488bd57a432e

📥 Commits

Reviewing files that changed from the base of the PR and between d12caed and a59fd17.

📒 Files selected for processing (1)
  • src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx

Walkthrough

The Next.js SDK documentation updates its metadata and adds guidance for composing Kinde’s withAuth proxy with custom middleware, preserving session cookies, handling public and protected routes, and integrating locale-based routing with next-intl.

Changes

Next.js middleware documentation

Layer / File(s) Summary
Authenticated middleware and session cookies
src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx
Updates the page metadata and documents custom authenticated logic, NextResponse returns, and refreshed Kinde session-cookie propagation.
Public and protected route composition
src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx
Adds a pattern for running middleware on public and protected routes, with next-intl locale-path guidance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: Update doc

Suggested reviewers: tamalchowdhury

Poem

A rabbit reads the proxy guide,
With cookies safely tucked inside.
Public paths hop, protected paths flow,
Locales bloom in rows below.
Middleware now knows where to go.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding documentation for chaining Next.js proxy and middleware functions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/add-nextjs-middleware-chaining

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the sdk label Aug 3, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploying kinde-docs-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: a59fd17
Status: ✅  Deploy successful!
Preview URL: https://30d6b5be.kinde-docs-preview.pages.dev
Branch Preview URL: https://fix-add-nextjs-middleware-ch.kinde-docs-preview.pages.dev

View logs

@onderay
onderay requested a review from tamalchowdhury August 5, 2026 04:39

@tamalchowdhury tamalchowdhury left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the heading and break the large opening paragraph into simpler statements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx`:
- Line 549: Remove the unmatched closing brace immediately following the proxy
block so the Next.js SDK example parses correctly; retain the brace that closes
proxy.
- Around line 543-547: Update the public-route branch around handleI18n and
authProxy to preserve Kinde refresh handling: compose handleI18n with the
documented withAuth callback, or run the refresh flow and merge its cookie
changes into the i18n response before returning it. Keep authenticated routes
using authProxy.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f765a50c-6f8d-43b8-ac41-7b0daae7282a

📥 Commits

Reviewing files that changed from the base of the PR and between cbdf527 and d12caed.

📒 Files selected for processing (1)
  • src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx

Comment thread src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx
Comment thread src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx Outdated

@dtoxvanilla1991 dtoxvanilla1991 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, CI needs a fix still.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation issue: chaining middleware with next

3 participants