Skip to content

fix(next/image): fix image-optimizer.ts headers (#82114)#2

Open
MitchLewis930 wants to merge 1 commit intopr_032_beforefrom
pr_032_after
Open

fix(next/image): fix image-optimizer.ts headers (#82114)#2
MitchLewis930 wants to merge 1 commit intopr_032_beforefrom
pr_032_after

Conversation

@MitchLewis930
Copy link

@MitchLewis930 MitchLewis930 commented Jan 30, 2026

PR_032


Note

Medium Risk
Changes request header propagation in the image optimizer, which can affect apps relying on cookies/headers for authenticated internal image endpoints and may alter caching/response behavior.

Overview
Stops fetchInternalImage from passing the original request’s headers into createRequestResponseMocks, so internal /_next/image optimization requests no longer inherit client headers like Cookie.

Adds an integration API route (/api/conditional-cookie) and a new test asserting that sending a cookie to /_next/image does not cause the optimizer to forward it upstream (request now fails with 400).

Written by Cursor Bugbot for commit 6b12c60. This will update automatically on new commits. Configure here.

The headers were forwarded to the serverless function for "internal"
images but not "external" images.

This changes the behavior to be the same for both such that neither
receive headers.
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.

2 participants