-
Notifications
You must be signed in to change notification settings - Fork 160
fix(converters): Ensure x-forwarded-proto is set to http when running locally #887
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 455985e The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
commit: |
I have to dig a bit further on this one. Turns out you might need an |
Im using this repo to test out. First build the repo with However when in // this is for the redirects to work with http
process.env.__NEXT_PRIVATE_ORIGIN = url.origin;
// this makes the signin button redirect to http
headers["x-forwarded-proto"] = "http"; Remember to change the overrides path in Notice the |
Alright, this one was a bit harder to debug than I initially thought. Turns out this is related to
There is some workarounds (
To see this yourself you can just add an API route in your app and run OpenNext locally either via import { NextRequest } from "next/server";
export async function GET(request: NextRequest) {
return Response.json({
// when running OpenNext locally this url with https when it should not
url: request.url,
})
} |
e5ec513
to
455985e
Compare
Discussed in #686 over at
opennextjs-cloudflare
next-auth
and possibly more libraries rely on thex-forwarded-proto
header to behttp
to work out of the box when run locally. Innext start
ornext dev
they set this tohttp
when ran locally.To make
opennextjs-cloudflarejs preview
and our node converter when running OpenNext locally behave the same we would want to set this header tohttp
. This would make the user not have to set anAUTH_URL
in those modes.