Skip to content

Commit

Permalink
fix: set x-vercel-sc-host for older versions of Next.js (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-elicx authored Nov 25, 2023
1 parent 2d5dde9 commit f364224
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-insects-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

Set `x-vercel-sc-host` request header for older versions of Next.js for the suspense cache.
4 changes: 4 additions & 0 deletions packages/next-on-pages/templates/_worker.js/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SUSPENSE_CACHE_URL } from '../../cache';

/**
* Adjusts the request so that it is formatted as if it were provided by Vercel
*
Expand All @@ -21,5 +23,7 @@ export function adjustRequestForVercel(request: Request): Request {
);
}

adjustedHeaders.set('x-vercel-sc-host', SUSPENSE_CACHE_URL);

return new Request(request, { headers: adjustedHeaders });
}

0 comments on commit f364224

Please sign in to comment.