Repository navigation
Load asset header rules only for responses served from assets - #474
Merged
Merged
Conversation
Requests that fall through to the app, such as server-rendered pages, no longer wait for an R2 read of /_headers. Redirect rules are still read first because they can rewrite any path to an asset.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 6be8061 | Nov 28 2026, 09:11 PM |
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.
Problem
serveAssetruns before the app for every GET and HEAD. It read/_headersfrom R2 before it knew whether the path is an asset. Server-rendered pages therefore waited for one R2 round trip whose result they never use. SvelteKit's Cloudflare adapter always emits/_headers, so this affects every page of such an app.Change
/_headersis now read only where its rules are applied: redirect responses from/_redirectsand responses served from assets./_redirectsis still read first, because a rewrite can map any path to an asset.A missing or oversized
/_headersno longer fails requests that the app answers. Responses that need the rules still fail as before.Tests
apps/control-plane/tests/runtime/dynamic.test.tsgets a host whose only rule file is/_headers. The test counts reads of that object: zero for a request the app answers, one for an asset response, and the rule still applies. The test fails without the change.RUN_DYNAMIC_TESTS=1suite on celld 0.6.3-widefleet.1: 25/25 passed.