feat(cli): reach a remote local server behind Cloudflare Access - #466
Open
alan-roe wants to merge 1 commit into
Open
feat(cli): reach a remote local server behind Cloudflare Access#466alan-roe wants to merge 1 commit into
alan-roe wants to merge 1 commit into
Conversation
Collaborator
|
Hey @alan-roe, this looks really good but I have some small points we should address before merging this in!
Also I'm curious to what your main use case is of using cloudflare access with it? |
The local-mode HTTP client only ever sent content-type, so a self-hosted 'maple start' instance behind an authenticating reverse proxy (Cloudflare Access tunnel) was unreachable from the CLI even though MAPLE_LOCAL_URL can already point at it. - packages/query-engine local client accepts optional extra headers (default unchanged; the bundled UI is unaffected) - MAPLE_LOCAL_HEADERS env: comma-separated Key=Value pairs (same format as OTEL_EXPORTER_OTLP_HEADERS) attached to every local-mode request, e.g. a CF Access service token - when the local URL is non-loopback https and no Access credential is configured, best-effort acquire a user-identity JWT via 'cloudflared access token' and send it as cf-access-token (one-time 'cloudflared access login <origin>' required) - 401/403 or a redirect to the Access login page fails with a typed error explaining both options Verified against a self-hosted instance behind Cloudflare Access.
alan-roe
force-pushed
the
feat/cli-cloudflare-access
branch
from
August 15, 2026 11:34
42e7d36 to
0cc922d
Compare
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
MAPLE_LOCAL_URLcan already point the CLI at a remotemaple startinstance, but the local-mode HTTP client sends onlycontent-type— there is no way to attach an auth header. Any self-hosted instance behind an authenticating reverse proxy (e.g. a Cloudflare Access tunnel, the natural way to expose a single-binary maple on a homelab box) is unreachable from the CLI.Changes
packages/query-engine/src/local.ts: the local query client accepts optional extra headers (genericRecord<string,string>; default unchanged, bundled UI unaffected)MAPLE_LOCAL_HEADERS: comma-separatedKey=Valuepairs (same format asOTEL_EXPORTER_OTLP_HEADERS), attached to every local-mode request — e.g. a CF Access service token for machinescloudflared access token -app=<origin>and sends it ascf-access-token. One-time setup is the standardcloudflared access login <origin>; missing binary/token degrades silently*.cloudflareaccess.com//cdn-cgi/access/fails with aSchema.TaggedErrorexplaining both options instead of a JSON parse errorlocal-mode/cli-reference.mdVerification
tsc --noEmitclean inapps/cliandpackages/query-engineNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.