Skip to content

Conversation

@javascripter
Copy link
Contributor

@javascripter javascripter commented Dec 2, 2025

Summary

  • Fix isExternal() to properly detect external URLs by parsing the URL and comparing the actual host, instead of using naive substring matching
  • The previous url.includes(host) check incorrectly identified URLs as internal when the request host appeared anywhere in the URL string (path, query params, etc.)
  • This broke rewrites to services like rendertron that embed the target URL in the path (e.g., https://rendertron.example.com/render/https://myapp.com/page)

Test plan

  • Added unit tests for embedded URL cases
  • Added unit tests for host:port matching
  • All existing tests pass

I also applied this patch locally to our website (not public) to confirm that this fixes the bug mentioned in this PR.

URL Request Host Old Result New Result
https://example.com/render/https://myapp.com/page myapp.com false true

@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

🦋 Changeset detected

Latest commit: ff3c183

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@javascripter javascripter marked this pull request as ready for review December 2, 2025 10:56
@javascripter javascripter marked this pull request as draft December 2, 2025 11:11
@javascripter javascripter marked this pull request as ready for review December 2, 2025 11:35
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM, could you please add a patch changeset (via pnpm changeset)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 2, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/aws@1046

commit: ff3c183

@vicb
Copy link
Contributor

vicb commented Dec 2, 2025

You also need to pnpm lint:fix to format the files before uploading the PR

@javascripter
Copy link
Contributor Author

@vicb Thanks for reviewing! I've added the changeset and fixed linting errors.

@vicb vicb merged commit c6bab5b into opennextjs:main Dec 2, 2025
3 checks passed
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.

2 participants