You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let Cloudflare Access callbacks reach the network - #799
Exclude /cdn-cgi/ from the service worker's navigation fallback so Cloudflare Access can handle the sign-in return. Add the same prefix to the server fallback and extend its reserved-path test with the reported callback.
Interface change
Producer · The Vite-generated service worker and the HTTP fallback in src/handlers/spa.rs.
Behavior change · A navigation under /cdn-cgi/ reaches the network. If it reaches Hatchdoor's fallback, the server returns a bare 404.
Consumers · Browsers with the installed worker and Cloudflare Access on the same hostname.
Compatibility and rollout · The normal service worker update activates this behavior. Returning to the previous build restores its previous navigation fallback.
Verification
just check passed in full mode, including the reserved-path and parity tests.
A local Chromium check with the generated worker confirmed a normal navigation used the cached shell and /cdn-cgi/access/authorized reached a fixture server.
Reviewed the HTTP API reference and updated it to describe the reserved prefix.
The patched worker has yet to be tested against a live Cloudflare Access sign-in.
Category: bug Summary: Finish and merge this PR, which fixes #798: the service worker sent the Cloudflare Access sign-in return (/cdn-cgi/access/authorized) to Hatchdoor's cached app instead of the network.
Current behavior:
The diff adds /cdn-cgi/ to the service worker's navigateFallbackDenylist and to the server's SPA_RESERVED_PREFIXES, extends a_reserved_prefix_gets_a_bare_404 with the reported callback path, adds a changelog entry, and updates the HTTP API reference and the module map. The cause it targets was reproduced in triage on #798. On development at 6830beb, a browser controlled by the installed worker that navigates to /cdn-cgi/access/authorized gets the app from the worker (fromServiceWorker: true, status 200).
Checked in triage on the PR head (8af02d3, based on current development): the four handlers::spa tests pass, the parity test included. The built sw.js denylist ends in /^\/cdn-cgi\//. In headless Chrome controlled by that worker, an unknown address (/some/unknown/page) still comes from the worker (status 200), while /cdn-cgi/access/authorized?token=x goes to the network and gets the server's bare 404. The diff does what it claims.
Gaps:
The PR body says Refs #798, so merging would leave the issue open.
The changelog entry quotes “Page Not Found” with curly quotes. The repo's prose uses straight quotes.
Nobody has tested the patched worker against a live Cloudflare Access sign-in, and neither the reporter nor triage can do that here. The browser criterion below is the acceptance bar, rerun on the final PR head.
Desired behavior:
A navigation to any path under /cdn-cgi/ reaches the network whether or not a service worker controls the page. Without Cloudflare in front, the server answers it with a bare 404, like the other reserved prefixes. Nothing else about the worker or the fallback changes.
Key interfaces:
navigateFallbackDenylist and SPA_RESERVED_PREFIXES: as the diff has them. The parity test reserved_prefixes_match_the_service_worker_denylist keeps them equal.
The PR's description: Closes #798, so the merge workflow closes the issue.
Acceptance criteria:
The built sw.js navigation route's denylist excludes paths starting with /cdn-cgi/.
A browser already controlled by the service worker that navigates to /cdn-cgi/access/authorized?... gets a response that did not come from the service worker (response.fromServiceWorker() is false in Playwright), while an unknown address such as /some/unknown/page still comes from the worker.
Without Cloudflare in front, GET /cdn-cgi/anything on the backend answers a bare 404, not the app.
reserved_prefixes_match_the_service_worker_denylist passes with /cdn-cgi/ on both sides.
The PR body says Closes #798.
The changelog entry uses straight quotes and stays one line under ## Unreleased / Fixed, ending in [#798].
The HTTP API reference and module-map wording still read true against the diff (just docs-freshness, then the ack).
just check passes on the PR head after review.
The PR is merged with ship-pr, as a merge commit, with the reporter's commit and authorship kept.
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
bugSomething isn't workingready-for-agentImplementation-ready for an engineering agent
2 participants
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.
Summary
Closes #798.
Exclude
/cdn-cgi/from the service worker's navigation fallback so Cloudflare Access can handle the sign-in return. Add the same prefix to the server fallback and extend its reserved-path test with the reported callback.Interface change
src/handlers/spa.rs./cdn-cgi/reaches the network. If it reaches Hatchdoor's fallback, the server returns a bare 404.Verification
just checkpassed in full mode, including the reserved-path and parity tests.A local Chromium check with the generated worker confirmed a normal navigation used the cached shell and
/cdn-cgi/access/authorizedreached a fixture server.Reviewed the HTTP API reference and updated it to describe the reserved prefix.
The patched worker has yet to be tested against a live Cloudflare Access sign-in.