fix(proxy): allow /.well-known/* and /embed/* on self-hosted#1874
Open
kovashikawa wants to merge 3 commits into
Open
fix(proxy): allow /.well-known/* and /embed/* on self-hosted#1874kovashikawa wants to merge 3 commits into
kovashikawa wants to merge 3 commits into
Conversation
The self-hosted proxy whitelist (active when NEXT_PUBLIC_IS_CAP !== "true")
did not include /.well-known/, so the Vercel Workflows runtime — which
dispatches itself via HTTP to /.well-known/workflow/v1/{step,flow,webhook} —
was 307-redirected to /login on every call. The transcription workflow
starts, the workflow runtime enqueues the first step, the HTTP callback is
intercepted, and no step ever executes.
Symptom on self-host: video uploads succeed, transcription is never
performed, AI features never run. Logs show transcribeVideo() being called
but no `[transcribe]` step lines and no Deepgram/Whisper request ever fires.
Adding /.well-known/ to the same whitelist that already includes /api,
/login, etc. restores the workflow callback path.
Resolves CapSoftware#1774. Root cause behind self-host AI breakage reported in CapSoftware#1356
and CapSoftware#1550.
The self-hosted proxy whitelist (active when NEXT_PUBLIC_IS_CAP !== "true") did not include /embed/, so embed routes were 307-redirected to /login. This broke <iframe src=".../embed/..."> embeds on every self-hosted instance — the iframe loads the login page instead of the embedded video. Same root cause and fix shape as the prior commit (/.well-known/): a path prefix that needs to be on the public allow-list was missing. Resolves CapSoftware#1768.
Per review feedback on CapSoftware#1874: the original prefix `/.well-known/` would auto-bypass the self-host auth redirect for any future route added under `.well-known/` (ACME challenges, OIDC discovery, etc.). The only subtree the Vercel Workflows runtime needs is `/.well-known/workflow/`, so scope the bypass exactly to that. Webhook auth still relies on `resumeWebhook(token, request)` in the framework-generated `/.well-known/workflow/v1/webhook/[token]/route.js`, which validates the token in-handler. Step/flow routes carry their own signature verification. This commit just narrows the proxy bypass; it does not change the underlying request-auth guarantees.
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
/.well-known/and/embed/to the self-host proxy whitelist.Root cause
apps/web/proxy.ts:40-58redirects every path not in an allow-list to/loginwhenNEXT_PUBLIC_IS_CAP !== "true"(i.e., self-hosted builds)./.well-known/and/embed/were both missing from that list./.well-known/(workflows broken)The Vercel Workflows runtime that Cap uses (
apps/web/app/.well-known/workflow/v1/{step,flow,webhook}/route.js) dispatches workflow steps by issuing HTTP requests back to itself at those routes. On self-host, those requests get a 307 →/login, so workflows are enqueued but never run.Visible symptom:
transcribeVideo()is called and logs[transcribeVideo] Triggering transcription workflow…, but no subsequent[transcribe]step lines ever appear, no Deepgram/Whisper request is made, andvideos.transcriptionStatusstaysNULLforever. Same foraiGenerationStatus./embed/(iframe embeds broken)<iframe src=".../embed/...">embeds on self-hosted instances load the login page instead of the embedded video, because the embed route also fails the proxy whitelist check.Fix
That's it. The matcher in
config.matcheralready excludes_next/*etc., and both prefixes are scoped to existing app routes, so widening is safe.Verification
Reproduced on a local Docker Compose self-host (
docker-compose.yml).Before this patch
curl http://localhost:3000/.well-known/workflow/v1/manifest.jsonreturns the Next.js HTML shell (the redirect-to-login response).POST /api/videos/:id/retry-transcription, leavestranscriptionStatus = NULLforever.After this patch
curlreturns the workflow manifest JSON (correct route).transcribeVideo(); the workflow runs end-to-end: audio extraction → transcription provider →transcription.vttwritten to S3 →transcriptionStatus = COMPLETE. AI generation then runs and writesmetadata.summary+metadata.chapters.Related
/.well-known/)/embed/)Greptile Summary
Two-line whitelist addition to the self-hosted proxy gate in
proxy.ts, restoring/.well-known/workflow callbacks and/embed/iframe routes that were incorrectly redirected to/login./.well-known/allows the Vercel Workflows runtime to call back to its own step/flow/webhook routes without being bounced; without this, transcription and AI generation workflows are silently enqueued but never execute./embed/allows unauthenticated access to embedded video player routes, which is the correct behaviour for public embeds on self-hosted instances.Confidence Score: 4/5
Safe to merge; the fix is minimal, targeted, and correctly scoped to routes that must be publicly reachable on self-hosted deployments.
The change is two lines in one file and the logic is easy to verify against the described failure. The only open question is whether the
/.well-known/workflow/v1/webhookhandler validates Vercel's request signature independently, since prefix matching now makes the entire/.well-known/tree reachable without the proxy auth check.The workflow route handlers under
apps/web/app/.well-known/workflow/v1/are worth a quick glance to confirm they verify the incoming request signature before acting.Important Files Changed
/.well-known/and/embed/to the self-host proxy auth bypass list; straightforward fix with prefix-match breadth worth notingPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(proxy): allow /embed/* on self-hoste..." | Re-trigger Greptile