fix(proxy): add /download to self-hosted path whitelist#1870
Open
stig-codes wants to merge 1 commit into
Open
Conversation
The proxy middleware redirects all non-whitelisted paths to /login when NEXT_PUBLIC_IS_CAP is not set. The /download route was missing from the whitelist, preventing users from reaching the desktop app download page.
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.
Summary
The
/downloadpath is missing from the self-hosted proxy whitelist inapps/web/proxy.ts, so the "Download Cap" button on the empty/dashboard/capspage (and any link to/download/apple-siliconetc.) gets 307-redirected to/loginfor every request — even from authenticated users. Self-hosted Cap users have no path to the desktop-app download page from inside the app.Root cause
apps/web/proxy.tsruns as middleware for self-hosted instances (NEXT_PUBLIC_IS_CAP !== "true"). When the path is not on the whitelist, the request is redirected to/login. The whitelist already contains/login,/signup,/invite,/self-hosting,/terms,/verify-otp— but not/download.Cap.so itself is unaffected because
NEXT_PUBLIC_IS_CAP=trueskips the proxy entirely.Fix
One line added to the whitelist:
path.startsWith("/signup") || path.startsWith("/invite") || path.startsWith("/self-hosting") || + path.startsWith("/download") || path.startsWith("/terms") || path.startsWith("/verify-otp") ) &&This covers
/download,/download/apple-silicon,/download/windows-x86_64,/download/apple-intel, and any future platform paths under/download/*.Test plan
pnpm i --frozen-lockfilesucceedspnpm run build:websucceedsGET /download→ 200 (renders the download page)GET /download/apple-silicon→ 307 redirect to the CrabNebula CDN (correct behavior — actual download starts)/loginas beforecap.so(cap.so skips this proxy entirely viaNEXT_PUBLIC_IS_CAP=true)Compatibility
NEXT_PUBLIC_IS_CAP=true.Related
Independent of #1869 (Authentik OIDC), filed as a separate PR per the principle that an unrelated bug fix shouldn't be bundled with a feature.
Greptile Summary
Adds
/downloadto the self-hosted proxy path whitelist inapps/web/proxy.ts, fixing a regression where any request to/downloador its sub-paths (e.g./download/apple-silicon) was 307-redirected to/loginon self-hosted instances. The change has no effect on Cap Cloud deployments (NEXT_PUBLIC_IS_CAP=trueskips this proxy entirely).startsWithwhitelist alongside the existing entries (/login,/signup,/invite, etc.), following the same pattern./download/*platform paths viastartsWith, consistent with how every other whitelisted prefix is matched.Confidence Score: 5/5
Safe to merge — the change is a single-line whitelist addition that restores access to a public download page on self-hosted instances without touching any authentication logic or other code paths.
The addition follows the exact same
startsWithpattern used by every other entry in the whitelist. The/downloadprefix is a publicly accessible page (desktop-app download) that has no business requiring a login gate, and the fix is clearly scoped to self-hosted deployments only.No files require special attention.
Important Files Changed
/downloadto the self-hosted path whitelist so desktop-app download pages are reachable without being redirected to/loginReviews (1): Last reviewed commit: "fix(proxy): whitelist /download path for..." | Re-trigger Greptile