Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: host not included in route handler urls #234

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

james-elicx
Copy link
Collaborator

fixes #210

Research into what happens internally in Next.js is available in #210 (comment).

OpenNext is removing the trustHostHeader: true option from the Next.js config if routing is disabled, and it considers routing disabled when config.middleware.external is truthy. This value is required to be true in the OpenNext config used for deploying to Cloudflare.

This PR changes the check to not strip it if there is external middleware.

Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: 5cee06c

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

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare 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

Copy link

pkg-pr-new bot commented Jan 8, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@234

commit: 5cee06c

@james-elicx james-elicx force-pushed the james/fix-missing-host-route-handler branch from 94c515a to 5cee06c Compare January 8, 2025 13:53
@vicb vicb requested a review from conico974 January 8, 2025 13:56
@vicb
Copy link
Contributor

vicb commented Jan 8, 2025

@conico974 could you please take a look when you have time? Thanks!

@vicb
Copy link
Contributor

vicb commented Jan 8, 2025

OpenNext is removing the trustHostHeader: true option from the Next.js config if routing is disabled, and it considers routing disabled when config.middleware.external is truthy

I was also thinking that we might want to switch to not using external middleware at least until we have a better story for multi worker app.

@james-elicx james-elicx marked this pull request as ready for review January 8, 2025 13:59
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.

Thanks for the PR and adding a test!

@james-elicx james-elicx merged commit 9ab86d4 into main Jan 9, 2025
7 checks passed
@james-elicx james-elicx deleted the james/fix-missing-host-route-handler branch January 9, 2025 16:40
wesbos added a commit to wesbos/wesbos that referenced this pull request Jan 10, 2025
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.

[BUG] Route Handler request always return "n" instead of the worker's origin
3 participants