Repository navigation
feat(proxy): branded 404 for unknown hosts behind admin gate - #97
Merged
Merged
Conversation
When the admin gate is enabled and a client IP that isn't allow-listed hits a host without a deployed app, the proxy used to return a 50-byte `<h1>404 - Not Found</h1>` body — indistinguishable from nginx/haproxy and confusing for users mid-DNS-propagation. Render a self-contained dark-mode HTML page instead: Temps "t" brand mark, `DEPLOYMENT_NOT_FOUND · 404` chip, the requested host, the request ID for support correlation, and a link to the domains docs. - New `branded_404` module in `temps-proxy` with an HTML-escape helper and `render(host, request_id) -> String`. Zero external assets (no fonts, scripts, or images) so the page works for hosts that still can't resolve other origins. - Reflected XSS defense: host (attacker-controlled via `Host:` header) and request_id are HTML-escaped before interpolation. - `meta robots noindex,nofollow` so misconfigured domains don't pollute search results. - Tests cover happy path, escape correctness, malicious host, quote escaping in request_id, no external asset references, and noindex.
dviejokfs
force-pushed
the
feat/branded-proxy-404
branch
from
May 26, 2026 05:52
2ebdb97 to
944916f
Compare
dviejokfs
pushed a commit
that referenced
this pull request
Aug 16, 2026
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
Replaces the bare
<h1>404 - Not Found</h1>returned by the admin-gate path with a self-contained branded HTML page so users hitting a host without a deployed app (e.g. mid-DNS-propagation) see a Temps page instead of something indistinguishable from nginx/haproxy.Reproducible today:
curl -i https://app1.temps.kfs.es/→ 50-byte generic HTML. With this PR: a dark-mode branded page with the Tempstmark, aDEPLOYMENT_NOT_FOUND · 404chip, the host, the request ID for support correlation, and a docs link.Scope
Only the admin-gate denial site in
crates/temps-proxy/src/proxy.rs(around line 3275). The static-file-not-found path inside a real deployment, and other internal 404s, are intentionally untouched in this PR — they live inside an app's own context where a custom 404 would be more appropriate.Implementation
crates/temps-proxy/src/branded_404.rsmodule with:escape(&str) -> StringHTML-escape helper (&<>"'→ entities)render(host, request_id) -> Stringreturning a complete HTML documentHostheader (attacker-controlled) andrequest_idare escaped before interpolation.meta robots noindex,nofollowso misconfigured domains don't pollute search results.crates/temps-proxy/src/lib.rs.proxy.rscall site updated to usebranded_404::render(&ctx.host, &ctx.request_id)— headers (Cache-Control, X-Request-ID, Content-Type, Content-Length) androuting_status = \"admin_gate_denied\"preserved.Test plan
cargo check --lib -p temps-proxy— passes (1 pre-existing workspace-profile warning, unrelated)cargo test --lib -p temps-proxy branded_404— 6 tests pass:escape_handles_html_metacharactersrender_embeds_host_and_request_idrender_escapes_malicious_host(verifies<img onerror=...>payload is escaped)render_escapes_quotes_in_request_idrender_is_self_contained_no_external_assets(asserts only two https URLs: docs link + footer)render_marks_noindexcurl -i https://app1.temps.kfs.es/returns 200-byte+ HTML with the brand mark, host name, and request ID.Notes
prefers-color-scheme: light.