Repository navigation
[miniflare] Add local development support for /cdn-cgi/image/ URL transformations [Part 3] #16678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
petebacondarwin
merged 9 commits into
cloudflare:main
from
mglewis:mattl/IMAGES-2346-cdn-cgi-image-local-transforms
Nov 30, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
69fd073
IMAGES-2346: Add local development support for /cdn-cgi/image/ URL tr…
mglewis 3d3ad15
IMAGES-2346: address review feedback on same-host source fetches and …
mglewis 92a6a14
IMAGES-2346: address review feedback on source fetching, error respon…
mglewis 019f4b9
IMAGES-2346: address review feedback on fallback redirects and encode…
mglewis 7774795
IMAGES-2346: keep the source path in onerror=redirect fallbacks
mglewis 2fa3f8f
IMAGES-2346: clarify allowed_origins behaviour in docs and changesets
mglewis 7838d28
IMAGES-2346: match production for SVG sources, same-host allowed orig…
mglewis df0ef2b
IMAGES-2346: address review feedback on route hostnames, ports, encod…
mglewis 8361f2b
IMAGES-2346: align local image security headers with production, simp…
mglewis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "miniflare": minor | ||
| "wrangler": minor | ||
| "@cloudflare/vite-plugin": minor | ||
| "@cloudflare/workers-utils": minor | ||
| --- | ||
|
|
||
| Add local development support for `/cdn-cgi/image/` URL transformations | ||
|
|
||
| When `images.url_transformations` (or `images.urlTransformations` in `cloudflare.config.ts`) is enabled, Miniflare now handles `/cdn-cgi/image/<options>/<source>` requests locally before they reach your Worker. Requests return a 404 when URL transformations aren't enabled for the Worker, and a 403 when the source image isn't allowed by `allowed_origins`. Transforms use the same low-fidelity Sharp-backed mock as `cf.image` fetches, so only resize, rotate, format conversion and a small set of options are applied. | ||
|
|
||
| This is a change in behaviour: previously `/cdn-cgi/image/` requests were passed through to the Worker during local development. | ||
|
|
||
| Requests made through `SELF` in `@cloudflare/vitest-plugin` bypass Miniflare's routing and are not intercepted. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@cloudflare/config": patch | ||
| "@cloudflare/workers-utils": patch | ||
| --- | ||
|
|
||
| Clarify the `images.url_transformations.allowed_origins` documentation | ||
|
|
||
| When `allowed_origins` is set, only the listed origins are allowed. The Worker's own zone isn't included unless it's listed. |
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.