Skip to content

Serve a bb page instead of frp's 404 on connect next - #6206

Merged
ymichael merged 1 commit into
mainfrom
bb/styled-frps-404-page-for-connect-next-thr_csqnnsb7dv
Oct 26, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/styled-frps-404-page-for-connect-next-thr_csqnnsb7dv

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

When frps can't complete a request, it answers with frp's built-in unstyled 404 page ("The page you requested was not found… Faithfully yours, frp."). That happens for a shared port whose local server isn't running, and for a subdomain whose proxy isn't registered yet during a reconnect. connect-next's gate passed that response straight through to the browser, so users saw frp's page instead of a bb connect one.

What changed

  • apps/connect-next/src/pages.ts: moved the HTML shell out of gatePage into a new gateDocument function. Added unreachablePageHtml(), a page in bb connect's style ("Nothing answered at this address") that refreshes every 10s and has a Retry button. The wifi-off glyph is now a shared constant used by both this page and offlinePage.
  • apps/connect-next/src/frps.ts: startFrps writes that page to 404.html in frps's temp dir and passes its path as frps custom404Page. In frp v0.71.0 this option is defined in pkg/config/v1/server.go, and frps serves the page from both NotFoundResponse (no proxy for the host) and the vhost proxy ErrorHandler (the local service refused the connection).

No wire changes and no CLI or doc changes.

Known limits:

  • frps always returns this page as a 404, whatever the request's Accept header says. frp's own page behaves the same way today.
  • A timeout inside frps still returns an empty 504. This is rare, because the gate's own head deadline usually fires first.

How you verified

  • New e2e test in apps/connect-next/test/gate.e2e.test.ts: "answers with a bb page when nothing listens behind a proxy". It points an frpc proxy at a closed port, then checks for a 404 whose body contains the bb page and no "frp". It fails without the frps change and passes with it.
  • pnpm exec turbo run typecheck test --filter=@bb/connect-next: typecheck passes, 91 tests pass, none skipped.

AGENT GENERATED

🤖 Generated with Claude Code

When frps cannot complete a request (a shared port whose local server is
down, or a subdomain whose proxy is not registered yet during a reconnect),
it answered with frp's built-in unstyled 404 page, which the gate passed
through. Configure frps custom404Page with a bb connect styled page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 3fcb678 into main Oct 26, 2026
20 checks passed
@ymichael
ymichael deleted the bb/styled-frps-404-page-for-connect-next-thr_csqnnsb7dv branch October 26, 2026 17:14
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.

1 participant