Repository navigation
TRAC-2749: feat - Serve local theme assets from the local renderer in Makeswift preview - #1428
Open
parthshahp wants to merge 3 commits into
Open
parthshahp wants to merge 3 commits into
parthshahp wants to merge 3 commits into
Conversation
parthshahp
force-pushed
the
parthshah/ltrac-3048-stencil-cli-1012-breaks-cdn-referenced
branch
from
November 20, 2026 15:59
6986b6d to
4fbffef
Compare
… Makeswift preview Cloudflare's legacy-origin bypass routes, such as */img/* and */assets/*, match anywhere in the path. Theme asset paths such as /stencil/<version>/img/... skipped the Makeswift worker and returned 404 from the live origin. In Makeswift preview, the local front door now sends the renderer's file routes (/stencil/*, /assets/*, and /favicon.ico) to the local renderer with the session secret. All other requests still go to the storefront, signed as before.
parthshahp
force-pushed
the
parthshah/ltrac-3048-stencil-cli-1012-breaks-cdn-referenced
branch
from
November 20, 2026 16:00
4fbffef to
680eade
Compare
parthshahp
marked this pull request as ready for review
November 20, 2026 16:00
rtalvarez
reviewed
Nov 20, 2026
…l renderer The renderer's file routes are GET routes, and hapi also answers HEAD for them. Other methods on those paths reach the renderer's catch-all route, so they now go to the storefront, signed, like every other request.
rtalvarez
approved these changes
Nov 20, 2026
jorgemoya
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
In Makeswift preview mode,
stencil startreturns 404 for local theme images such as{{cdn "assets/img/coming-soon.jpg"}}. Version 9.1.0 serves them.The cause is Cloudflare's legacy-origin bypass routes. The preview front door sends every request to the storefront, so
/stencil/<version>/img/coming-soon.jpgskips the Makeswift worker and the tunnel. The live origin answers it and returns 404, because the local version ID does not exist there. JS and CSS still load becausedist/andcss/are not bypass routes.createPreviewProxysends the renderer's file routes (/stencil/*,/assets/*, and/favicon.ico) to the local renderer withx-stencil-preview-secret. These routes come fromserver/plugins/router/router.module.js.Hostcheck, theOrigincheck, and the path normalization still run for every request.MakeswiftPreviewkeeps the renderer port fromstart()and passes it to the proxy.I tested this against a Makeswift-enabled production store running Cornerstone. Before the fix,
/stencil/<v>/img/coming-soon.jpgreturned 404 from the live origin. After the fix, it returns 200 with the local file's bytes. The 5 local asset URLs on the home page load, and the home page still goes through the Makeswift worker.Tickets / Documentation
cc @bigcommerce/storefront-team