Skip to content

fix: add /embed/ and /.well-known/ to self-hosting proxy whitelist#1951

Open
shashank-sn wants to merge 2 commits into
CapSoftware:mainfrom
shashank-sn:fix/self-hosting-proxy-whitelist
Open

fix: add /embed/ and /.well-known/ to self-hosting proxy whitelist#1951
shashank-sn wants to merge 2 commits into
CapSoftware:mainfrom
shashank-sn:fix/self-hosting-proxy-whitelist

Conversation

@shashank-sn

@shashank-sn shashank-sn commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Adds /embed/ and /.well-known/ paths to the self-hosting proxy whitelist in apps/web/proxy.ts.

On self-hosted deployments (when NEXT_PUBLIC_IS_CAP !== "true"), the proxy middleware redirects all unwhitelisted paths to /login. Two important routes were missing:

  1. /embed/<videoId> — breaks iframe embeds on self-hosted instances. The share page works correctly because /s/ is already whitelisted; /embed/ was overlooked. This was fully root-caused by the community in /embed/* routes redirect to /login on self-hosted, breaking iframe embeds #1768.

  2. /.well-known/workflow/v1/* — blocks the workflow/queue dispatch used by transcription, AI summaries, and video processing. The Turbopack standalone build returns the SPA HTML shell instead of routing to the handlers. Root-caused in /.well-known/workflow/v1/* routes blocked by proxy whitelist on self-hosted #1774 and Self-hosted video processing silently broken: .well-known/workflow/v1/* route handlers return the SPA HTML shell (Turbopack standalone build) #1944.

Fix

Two lines added to the existing whitelist pattern:

 path.startsWith("/verify-otp") ||
+path.startsWith("/embed/") ||
+path.startsWith("/.well-known/")

Verification

Fixes #1768, #1774, #1944, #906

Greptile Summary

This PR expands the self-hosted proxy allowlist for public routes. The main changes are:

  • /embed/ requests can reach embed pages instead of /login.
  • /.well-known/ requests can reach well-known and workflow routes.
  • The change is limited to apps/web/proxy.ts.

Confidence Score: 4/5

The /.well-known/ allowlist entry should be tightened before merging.

  • /embed/ appears to route through existing video visibility checks.
  • /.well-known/ is broader than the known workflow and static well-known paths.
  • Any unprotected handler under that namespace can now be reached without the proxy login gate.

apps/web/proxy.ts

Security Review

The broad /.well-known/ prefix creates a security-boundary risk for any handler under that namespace that does not enforce its own auth or signature checks.

Important Files Changed

Filename Overview
apps/web/proxy.ts Adds /embed/ and /.well-known/ to the self-hosted proxy allowlist; the broad well-known prefix should be narrowed or paired with route-level protection.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/web/proxy.ts:60
**Broad Well-Known Whitelist**

When self-hosted production traffic reaches any dynamic route under `/.well-known/`, this prefix lets it bypass the proxy login gate. The inspected app has workflow routing configured under this namespace, so if any current or later handler there lacks its own auth or signature check, unauthenticated callers can reach processing endpoints that were previously blocked by the proxy.

### Issue 2 of 2
apps/web/proxy.ts:58-60
**Whitelist Indentation Drift**

These two entries are indented differently from the surrounding `path.startsWith(...)` clauses. The repo’s TS formatting rules require tab-aligned indentation, so this hunk can be reformatted or flagged by the formatter.

```suggestion
				path.startsWith("/verify-otp") ||
				path.startsWith("/embed/") ||
				path.startsWith("/.well-known/")
```

Reviews (1): Last reviewed commit: "fix: add /embed/ and /.well-known/ to se..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

Comment thread apps/web/proxy.ts Outdated
Comment thread apps/web/proxy.ts Outdated
path.startsWith("/verify-otp")
path.startsWith("/verify-otp") ||
path.startsWith("/embed/") ||
path.startsWith("/.well-known/")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Broad Well-Known Whitelist

When self-hosted production traffic reaches any dynamic route under /.well-known/, this prefix lets it bypass the proxy login gate. The inspected app has workflow routing configured under this namespace, so if any current or later handler there lacks its own auth or signature check, unauthenticated callers can reach processing endpoints that were previously blocked by the proxy.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/proxy.ts
Line: 60

Comment:
**Broad Well-Known Whitelist**

When self-hosted production traffic reaches any dynamic route under `/.well-known/`, this prefix lets it bypass the proxy login gate. The inspected app has workflow routing configured under this namespace, so if any current or later handler there lacks its own auth or signature check, unauthenticated callers can reach processing endpoints that were previously blocked by the proxy.

How can I resolve this? If you propose a fix, please make it concise.

Comment thread apps/web/proxy.ts Outdated
…telist

On self-hosted deployments (NEXT_PUBLIC_IS_CAP !== "true"), the proxy
redirects unwhitelisted paths to /login. The /embed/<videoId> route
breaks iframe embeds, and /.well-known/workflow/v1/* routes needed by
the workflow/queue system return the SPA shell instead of routing to
their handlers.

Only whitelisting /.well-known/workflow/ (not the entire /.well-known/
namespace) — the workflow prefix is the specific sub-path that needs
bypass, keeping other well-known URIs behind the auth gate.

Fixes CapSoftware#1768, fixes CapSoftware#1774, fixes CapSoftware#1944, fixes CapSoftware#906

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@shashank-sn shashank-sn force-pushed the fix/self-hosting-proxy-whitelist branch from 73517b3 to 732a4bd Compare June 29, 2026 02:14

@shashank-sn shashank-sn left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed the well-known review comment — narrowed from /.well-known/ to /.well-known/workflow/ so only the workflow queue prefix bypasses the proxy gate, not the entire well-known namespace.

Align the new /embed/ and /.well-known/workflow/ entries with the
surrounding tab-indented path.startsWith calls.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

@shashank-sn shashank-sn left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments addressed:

  • Well-known whitelist narrowed: Changed from /.well-known/ to /.well-known/workflow/ — only the workflow prefix bypasses the proxy gate now.
  • Indentation drift: Fixed in 795b614 — entries now tab-aligned with surrounding path.startsWith() calls.
  • Trailing slash: Intentional — /embed (without slash) and /.well-known (without slash) are non-functional paths. Only sub-routes need bypass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/embed/* routes redirect to /login on self-hosted, breaking iframe embeds

1 participant