Support cf.image transformations in local dev#14221
Merged
edmundhung merged 4 commits intoJun 15, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: cebfded The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 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 |
a52bd41 to
0698951
Compare
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
0698951 to
7e30de7
Compare
7e30de7 to
c01768f
Compare
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
edmundhung
reviewed
Jun 9, 2026
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
edmundhung
approved these changes
Jun 15, 2026
edmundhung
left a comment
Member
There was a problem hiding this comment.
Looks good to me. Can you address the remaining feedbacks from devin? If they are invalid, just leave a comment and resolve them.
Could you please get a review from your team too?
workers-devprod
approved these changes
Jun 15, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
LGTM from an Images perspective ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes IMAGES-2308 and (the ancient) #4385
fetch(url, { cf: { image: { ... } } })allows workers to take advantage of the longstanding transform via Workers feature to transform images . Prior to this change, this feature is not supported in localwrangler dev- thecfobject is dropped and the source image bytes are returned.We already use Sharp to mock some of the more basic capabilities of the images binding. We are repeating the trick here and using it to resize our images we
fetch. After we ship, we'll have much closer parity with production.Changes
strip-cf-connecting-ipworker). It does the existingCF-Connecting-IPheader rewrite and the newcf.imagetransform, then continues down the chain.cf.imageoptions, the interceptor fetches the origin image (stampingVia: image-resizingfor loop-prevention parity) and hands the bytes to a new Node-side Sharp fetcher (cfImageLocalFetcher) over the existing loopback bridge.fitmodes, theformat: "json"output shape, thecf-resizedheader. Only resize, rotate and format are honoured, unsupported options are ignored.Reviewer considerations
stripCfConnectingIp: falsehas been changed for a toggle on a worker to instead toggling the header strip functionality in our outbound inteceptor worker.Testing
New spec (
test/plugins/core/cf-image.spec.ts). Sanity-checked end-to-end against a demo worker under a localwrangler devbuild vs published wrangler.A picture of a cute animal (not mandatory, but encouraged)