Skip to content

Conversation

sommeeeer
Copy link
Contributor

Closes opennextjs/opennextjs-cloudflare#750

There is some issue with Firefox and possibly some CDNs that they will incorrectly be reusing RSC responses during bfcache restores. Adding a Vary header seems to solve the problem.

Copy link

changeset-bot bot commented Jun 24, 2025

🦋 Changeset detected

Latest commit: 64ee772

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

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router 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

pkg-pr-new bot commented Jun 24, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@916

commit: 64ee772

@sommeeeer sommeeeer requested a review from vicb June 25, 2025 15:14
@sommeeeer
Copy link
Contributor Author

Thanks for the reviews @vicb and @khuezy

Copy link
Contributor

@khuezy khuezy left a comment

Choose a reason for hiding this comment

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

LGTM. I thought I saw something about nextjs putting the vary header back in the newer release? Do we need to patch it on a specific version?

@sommeeeer
Copy link
Contributor Author

sommeeeer commented Jun 25, 2025

I thought I saw something about nextjs putting the vary header back in the newer release? Do we need to patch it on a specific version?

Yeah they did, but they added it back in version 15.3.3. I guess theres no point making a patch for NextServer, as we can probably just tell the users to upgrade to that version or higher.

Edit: This is also a really hard edge case to hit only in Firefox, and it does require you to have a redirect in the middleware to a route with RSC. Firefox caches the _rsc response instead of the actual page then.

@vicb
Copy link
Contributor

vicb commented Jun 25, 2025

I thought I saw something about nextjs putting the vary header back in the newer release? Do we need to patch it on a specific version?

Yeah they did, but they added it back in version 15.3.3. I guess theres no point making a patch for NextServer, as we can probably just tell the users to upgrade to that version or higher.

Edit: This is also a really hard edge case to hit only in Firefox, and it does require you to have a redirect in the middleware to a route with RSC. Firefox caches the _rsc response instead of the actual page then.

The reason why I did not formally approve is that I have no clue if the value for the vary header will fix all cases.
If Next uses the same value, maybe you could add a link to the PR/code in the comment?

@khuezy
Copy link
Contributor

khuezy commented Jun 25, 2025

We could expand the playwright tests to include the other browsers too.

@sommeeeer sommeeeer requested a review from conico974 June 25, 2025 19:31
@conico974 conico974 merged commit f2c86ca into opennextjs:main Jun 25, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Jun 25, 2025
@sommeeeer sommeeeer deleted the fix-firefox branch June 25, 2025 20:40
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.

[BUG] Prefetching a link that is a redirect redirects to RSC output

4 participants