feat: Support built-in authentication in the Cloudflare host - #1830
Open
Adityakk9031 wants to merge 9 commits into
Open
feat: Support built-in authentication in the Cloudflare host#1830Adityakk9031 wants to merge 9 commits into
Adityakk9031 wants to merge 9 commits into
Conversation
Adityakk9031
force-pushed
the
feature/cloudflare-host-builtin-auth
branch
from
August 28, 2026 18:35
7ae39ef to
98ed6c9
Compare
…ustedOrigins/secureCookies
…resilient CI execution
Contributor
Author
|
@RhysSullivan have a look .happy for feedback |
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
The Cloudflare host currently requires Cloudflare Access. The Worker returns an unavailable response when
ACCESS_TEAM_DOMAINorACCESS_AUDis absent.This requirement makes Cloudflare Access part of the host's security and deployment model, preventing operators who cannot or do not want to enroll in Zero Trust from using the hosted Worker deployment.
Proposal
This PR adds an opt-in built-in authentication mode (
AUTH_MODE=builtin) toapps/host-cloudflare, while keepingAUTH_MODE=accessas the default.Key Changes
apps/host-selfhostinto the sharedpackages/core/apipackage (under@executor-js/api/server).BetterAuthDbClientinterface.apps/host-selfhostto consume the extracted shared Better Auth components, ensuring 100% regression-free backward compatibility.d1ClientAdapterwrapper to implement the sharedBetterAuthDbClientover Cloudflare D1.BETTER_AUTH_SECRET(orAUTH_SECRET) whenAUTH_MODE=builtin, failing closed if it is absent or less than 32 characters./api/auth/*), Admin (/api/admin/*), and System (/api/setup-status) routes inhost-cloudflarewhen running in built-in mode.webSPA folder inapps/host-cloudflare.apps/host-cloudflare's Vite build configuration directly toapps/host-selfhost/web/.__root.tsxroute to query/api/setup-statusat boot to dynamically resolve the auth mode (redirecting to/cdn-cgi/access/loginon 404/Access mode, and rendering Setup/Login pages in Builtin mode).Closes #1793