Skip to content

Conversation

@pilcrowonpaper
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

⚠️ No Changeset found

Latest commit: d2b12f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sommeeeer
Copy link
Collaborator

Hello @pilcrowonpaper, good to see you here :) looks good on first glance, I'll do another review later!

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 20, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@999

commit: d2b12f7

} else {
const cacheControlHeader = imageResponse.headers.get("Cache-Control");
if (cacheControlHeader !== null) {
immutable = cacheControlHeader.includes("immutable");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Next.js does something more complicated and bases the optimized response on the upstream Cache-Control header. I didn't want to do anything complex for now so it just checks if the upstream image is a static content

@pilcrowonpaper
Copy link
Contributor Author

It looks like the Playwright tests are failing because the test cases don't include the required w and q parameters.

@pilcrowonpaper
Copy link
Contributor Author

@vicb
Should the behavior match Next.js 15 or 16 in general? Or should we check the version and change the behavior based on it? Not sure what the policy is on Next.js versions

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Awesome @pilcrowonpaper !

I have done a frist round of review.

Could you please add JSDoc comments to added functions.
Maybe there could be separate functions to i.e. validate each parameter?

@vicb vicb marked this pull request as ready for review November 25, 2025 13:19
@pilcrowonpaper
Copy link
Contributor Author

@vicb I updated the endpoint to match the previous behavior and return the unoptimized image as is if the image format isn't supported by Cloudflare Images

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Thanks a lot @pilcrowonpaper 🎉

I have done some minor refactoring to split the huge functions, add comments and fix 2 minor typos.

@vicb vicb force-pushed the worker-image-binding branch from 825072f to d4075ea Compare November 27, 2025 14:10
@vicb
Copy link
Contributor

vicb commented Nov 27, 2025

Rebased + fix tests

@vicb vicb merged commit 50d7427 into opennextjs:main Nov 27, 2025
7 checks passed
@vicb vicb mentioned this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants