Skip to content

Conversation

@yuripave
Copy link
Contributor

@yuripave yuripave commented Sep 17, 2025

On local service bindings, cross worker RPC will go through miniflare API proxy. Previous implementation of Headers serialization used Object.fromEntries() which works for most cases except when there are multiple Set-Cookie headers (since objects can't have duplicate keys). This PR fixes this by serializing Headers as an array of [key, value] pairs using [...headers.entries()] instead, which preserves all header values including multiple Set-Cookie headers.


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix
  • Wrangler V3 Backport

@yuripave yuripave requested a review from a team as a code owner September 17, 2025 04:23
@changeset-bot
Copy link

changeset-bot bot commented Sep 17, 2025

🦋 Changeset detected

Latest commit: 3fd1a64

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

This PR includes changesets to release 5 packages
Name Type
miniflare Patch
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler 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
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Thanks! This looks fantastic to me @yuripave 🚀 🫶

The only thing missing, could you please add a changeset for this fix? 🙂
(via npx changeset at the root of the repo)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 17, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 3fd1a64

@yuripave yuripave force-pushed the fix-miniflare-rpc-headers branch 2 times, most recently from 385e7a8 to f88ffb7 Compare September 17, 2025 13:04
@yuripave
Copy link
Contributor Author

Thanks! This looks fantastic to me @yuripave 🚀 🫶

The only thing missing, could you please add a changeset for this fix? 🙂 (via npx changeset at the root of the repo)

done!

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

@yuripave I'm really sorry for missing your earlier message, thanks for having pinged me again! 🙇

Again, looks great to me! 😄 with just one very minor final suggestion 🙂

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Sep 20, 2025
@yuripave yuripave force-pushed the fix-miniflare-rpc-headers branch from f88ffb7 to 3fd1a64 Compare September 20, 2025 16:44
@petebacondarwin petebacondarwin merged commit 2432022 into cloudflare:main Sep 26, 2025
45 of 49 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Sep 26, 2025
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label Sep 26, 2025
@holopin-bot
Copy link

holopin-bot bot commented Sep 26, 2025

Congratulations @yuripave, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmg0ujf3u002ml804y9v0alf4

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

petebacondarwin pushed a commit that referenced this pull request Sep 29, 2025
* fix(miniflare): api proxy preserve multiple Set-Cookie headers

* [miniflare] custom serialization for RegExp object (#9454)

* feat: encode pattern when serialize RegExp object

* test: check if test suites can be filtered by pattern includes non-ascii string

* chore: remove unneeded comment

* test: serialize RegExp object

* docs: add changeset for vitest-pool-workers to describe fix

---------

Co-authored-by: Calvin Tsang <yuripave@gmail.com>
Co-authored-by: Enchan <enchant0130@gmail.com>
Co-authored-by: Victor Berchet <victor@suumit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution [Holopin] Recognizes an open-source contribution, big or small

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants