Skip to content

[BUG] edge converter overwrites x-forwarded-host with host #1182

Description

@ktKongTong

Relate: #753,#752

OpenNext currently overwrites x-forwarded-host with result.internalEvent.headers.host

headers: {
...result.internalEvent.headers,
"x-forwarded-host": result.internalEvent.headers.host,
},

This means any existing x-forwarded-host is discarded and replaced with the current host value.

This causes problems in Cloudflare Worker:

user request header:

x-forwarded-host: foo
host: bar

plain worker view:

x-forwarded-host: foo
host: bar

opennextjs/cloudflare view:

x-forwarded-host: bar
host: bar

my use case:

better-auth use x-forwarded-host and x-forward-proto to determine baseURL when trustedProxyHeaders enabled

https://better-auth.com/docs/reference/security#trusted-proxy-headers

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions