Skip to content

Release 0.14.1-beta.1: Next.js rewrite middleware fix - #50

Merged
sergak01 merged 5 commits into
mainfrom
develop
Feb 25, 2026
Merged

Release 0.14.1-beta.1: Next.js rewrite middleware fix#50
sergak01 merged 5 commits into
mainfrom
develop

Conversation

@sergak01

@sergak01 sergak01 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Merge develop into main for release 0.14.1-beta.1.

Changes

  • fix(nextjs): Rewrite response middleware for Next.js page URLs (PP-2836)
  • chore(test-nextjs): Add miHudLess config and update package-lock
  • docs: Update CI badges for pp-dev repo
  • chore(release): 0.14.1-beta.1****

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed response middleware handling for Next.js page URLs.

sergak01 and others added 5 commits February 24, 2026 18:24
Next.js serves page HTML at base path/subpaths (e.g. /p/test-nextjs/) rather than index.html.
Update predicate to match pathname.startsWith(base) && !pathname.includes('/_next/').
PP-2836 fix(nextjs): rewrite response middleware for Next.js page URLs
## [0.14.1-beta.1](v0.14.0...v0.14.1-beta.1) (2026-02-24)

### Bug Fixes

* **nextjs:** rewrite response middleware for Next.js page URLs ([3e80f41](3e80f41))
@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A bug fix release (0.14.1-beta.1) updating the Next.js rewrite response middleware logic to properly exclude Next.js static assets by checking for /_next/ patterns, alongside version and documentation updates.

Changes

Cohort / File(s) Summary
Release Artifacts
CHANGELOG.md, package.json
Version bump to 0.14.1-beta.1 with new changelog entry documenting the Next.js middleware rewrite response fix.
CI/Documentation
README.md
Updated GitHub workflow badges from publish.yml to release.yml and ci.yml (develop branch CI).
Middleware Logic
src/cli.ts
Rewrote Rewrite Response middleware matching logic: now computes pathname and checks if it starts with base and excludes /_next/ paths, replacing the previous index.html suffix check. Added clarifying comments for middleware chain declarations.
Test Configuration
tests/test-nextjs/pp-dev.config.ts
Added miHudLess: true property to PPDevConfig object.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • michailozdemir
  • Sadilenko
  • MaksymovVolodymyr

Poem

🐰 A hop and a fix to the Next.js flow,
No more index.html in the way,
/_next/ paths now safely go,
While badges shine bright for the CI relay,
Version bumped—onward we race! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: a release for version 0.14.1-beta.1 focused on fixing the Next.js rewrite middleware, which is the core objective reflected in the commit messages and file changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/cli.ts (1)

983-999: Core fix logic is correct — consider adding a test for the new predicate

The predicate pathname.startsWith(base) && !pathname.includes('/_next/') is well-reasoned:

  • startsWith(base) is sound because base always ends with / (enforced at Lines 695–697), so it won't spuriously match sibling paths.
  • !includes('/_next/') is necessary for Next.js static assets served under the base prefix (e.g. /p/test-nextjs/_next/static/…). Root-level /_next/ routes are already short-circuited to essentialMiddlewareChain at Lines 741–745; this guard covers the remaining case.

The existing integration tests in tests/integration/middleware/rewrite-response.spec.ts exercise initRewriteResponse with a standalone url.endsWith('index.html') matcher and don't cover the production predicate. A dedicated test for the new logic (both the happy path and the /_next/ exclusion) would guard against regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 983 - 999, Add an integration test for the new
predicate used when creating rewriteResponseMiddleware (the call to
initRewriteResponse) that asserts requests with pathnames starting with base
(remember base ends with '/') are rewritten via mi!.buildPage/urlReplacer and
that requests containing '/_next/' under the base are excluded; update
tests/integration/middleware/rewrite-response.spec.ts to include at least two
cases: a positive case where pathname.startsWith(base) triggers the rewrite and
a negative case where pathname includes '/_next/' under the base does not
trigger the rewrite (and ensure headers/host are set so the same code path is
exercised).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/cli.ts`:
- Around line 983-999: Add an integration test for the new predicate used when
creating rewriteResponseMiddleware (the call to initRewriteResponse) that
asserts requests with pathnames starting with base (remember base ends with '/')
are rewritten via mi!.buildPage/urlReplacer and that requests containing
'/_next/' under the base are excluded; update
tests/integration/middleware/rewrite-response.spec.ts to include at least two
cases: a positive case where pathname.startsWith(base) triggers the rewrite and
a negative case where pathname includes '/_next/' under the base does not
trigger the rewrite (and ensure headers/host are set so the same code path is
exercised).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c862ea and 77548b6.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • tests/test-nextjs/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • package.json
  • src/cli.ts
  • tests/test-nextjs/pp-dev.config.ts

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.

3 participants