Skip to content

feat - Return Makeswift page identity headers from the local renderer - #1419

Merged
parthshahp merged 3 commits into
parthshah/rewrite-linksfrom
parthshah/ltrac-2121-stencil-cli-return-makeswift-page-identity-headers-from-the-local
Oct 19, 2026
Merged

parthshahp merged 3 commits into
parthshah/rewrite-linksfrom
parthshah/ltrac-2121-stencil-cli-return-makeswift-page-identity-headers-from-the-local

Conversation

@parthshahp

Copy link
Copy Markdown
Contributor

What?

Two changes for the Makeswift tunnel preview. Reviewing by commit will make this easier.

  • Strip preview and dispatch headers on every local origin request. A tunnel request can carry the x-stencil-preview-* headers, the dispatch router headers (x-bc-makeswift-*, x-bc-stencil-worker-name, x-platform-dispatch-router-proxy), and Cloudflare and cloudflared metadata (cf-*, cdn-loop). The renderer and the router proxy routes now remove them before the request goes to the store. In preview mode, the renderer sends x-platform-dispatch-router-proxy: 1, so the store request goes directly to origin and does not go through the Makeswift worker again.
  • Return the Makeswift page identity headers from the local renderer. PencilResponse copied only set-cookie from the Storefront response. The worker needs x-makeswift-stable-page-reference to find the Makeswift content for a page. Without it, the worker returns the page without Makeswift content. The renderer now also returns x-makeswift-stable-page-reference, x-makeswift-page-locale, and x-makeswift-storefront-token when Storefront sends them. The worker removes the token before the response goes to the browser.

Tickets / Documentation

cc @bigcommerce/storefront-team

@parthshahp
parthshahp added this pull request to stack #1417 October 8, 2026 20:08
Comment thread server/plugins/renderer/renderer.module.js Outdated
Comment thread server/lib/utils.js Outdated
}
// Headers that a tunnel request can carry and that must not go to the store: the preview
// headers, the dispatch router headers, and Cloudflare and cloudflared request metadata.
const HOP_HEADER_PREFIXES = ['x-stencil-preview-', 'x-bc-makeswift-', 'cf-'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if these deletions are even needed at this point 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed that commit completely, this PR now only contains the makeswift required headers.

@parthshahp
parthshahp force-pushed the parthshah/ltrac-2121-stencil-cli-return-makeswift-page-identity-headers-from-the-local branch from 57199c3 to cb3aeba Compare October 9, 2026 15:06
@parthshahp parthshahp changed the title feat: Strip tunnel headers and return Makeswift page headers in preview feat - Return Makeswift page identity headers from the local renderer Oct 9, 2026
@parthshahp
parthshahp force-pushed the parthshah/ltrac-2121-stencil-cli-return-makeswift-page-identity-headers-from-the-local branch from cb3aeba to 3d8bd16 Compare October 16, 2026 14:31
@jairo-bc
jairo-bc requested a review from rtalvarez October 19, 2026 16:52
parthshahp and others added 3 commits October 19, 2026 14:06
* feat: automatically install cloudflared for Makeswift preview

* fix: stop Makeswift preview when cloudflared exits unexpectedly
@parthshahp
parthshahp force-pushed the parthshah/ltrac-2121-stencil-cli-return-makeswift-page-identity-headers-from-the-local branch from fe367f7 to 41b9258 Compare October 19, 2026 19:06
@parthshahp
parthshahp merged commit 319927c into master Oct 19, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 10.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants