Skip to content

Add MF-Original-Hostname header when using the upstream option#11883

Merged
dario-piotrowicz merged 2 commits intomainfrom
dario/11876/original-hostname
Jan 14, 2026
Merged

Add MF-Original-Hostname header when using the upstream option#11883
dario-piotrowicz merged 2 commits intomainfrom
dario/11876/original-hostname

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz commented Jan 12, 2026

Note

This PR was mostly written by Claude Opus 4.5, I've made minor modifications and reviewed the code

Fixes #11876

When using the upstream option in Miniflare, the Host header is rewritten to match the upstream server, which means the original hostname is lost. This change adds a new MF-Original-Hostname header that preserves the original hostname from the incoming request.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation

A picture of a cute animal (not mandatory, but encouraged)

@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner January 12, 2026 22:20
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 12, 2026

🦋 Changeset detected

Latest commit: e16e916

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

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jan 12, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11883

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11883

miniflare

npm i https://pkg.pr.new/miniflare@11883

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11883

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11883

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11883

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11883

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11883

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11883

wrangler

npm i https://pkg.pr.new/wrangler@11883

commit: e16e916

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jan 13, 2026
@dario-piotrowicz dario-piotrowicz changed the title Add X-Miniflare-Original-Hostname header when using the upstream option Add MF-Original-Hostname header when using the upstream option Jan 13, 2026
@dario-piotrowicz dario-piotrowicz force-pushed the dario/11876/original-hostname branch from a46dd4b to e16e916 Compare January 13, 2026 23:53
@dario-piotrowicz dario-piotrowicz merged commit 4714ca1 into main Jan 14, 2026
35 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/11876/original-hostname branch January 14, 2026 00:40
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Do not lose the Host information when using Miniflare with upstream option.

3 participants