3.7 KiB
id, name, status, depends_on, scope, risk, impact, level, review_findings, adr
| id | name | status | depends_on | scope | risk | impact | level | review_findings | adr | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fix/remove-health-and-hardcode-https | Remove /health from main listener and hardcode X-Forwarded-Proto to https | completed | narrow | low | component | implementation |
|
|
Description
Two related changes that simplify the proxy handler:
-
W5 / ADR-022: Remove the
/healthroute from the main HTTPS listener. Health checking is an operational concern served exclusively by the dedicated local port (9900) and the admin socket'sstatuscommand. Serving/healthon the main listener creates collision with upstream applications and requires special-case routing before host matching. The route must be removed entirely — no configurable path replacement. -
W14: Remove the
is_httpsfield fromProxyStateand hardcodeX-Forwarded-Proto: httpsininject_proxy_headers. The proxy only proxies requests on the HTTPS listener (which always uses TLS), and the HTTP redirect listener sends 301 redirects rather than proxying. Theis_httpsfield was alwaystrueand was a latent bug for non-TLS contexts. Since there is no non-TLS proxying path, hardcoding"https"with a clear comment is correct.
Changes Required
src/proxy/handler.rs:
- Remove
health_handlerfunction - Remove the
/healthearly return inproxy_handler(lines 37-39) - Remove
is_httpsfield fromProxyStatestruct - Remove
is_httpsparameter fromproxy_router()— it's no longer needed - Remove the
/healthroute fromproxy_router()—Router::new().fallback(proxy_handler).with_state(state)instead ofRouter::new().route("/health", get(health_handler)).fallback(proxy_handler).with_state(state)
src/proxy/headers.rs:
- Change
inject_proxy_headerssignature to removeis_https: boolparameter - Hardcode
X-Forwarded-Prototo"https"with a comment explaining why:// X-Forwarded-Proto is always "https" because this proxy only forwards requests // received on the TLS listener. The HTTP listener redirects to HTTPS and does not // proxy requests, so X-Forwarded-Proto is never set for HTTP connections.
src/main.rs:
- Remove
is_https: truefromProxyStateinitialization - Update any calls to
proxy_router()orbuild_router()that passis_https
src/proxy/mod.rs:
- Update
build_routersignature if it referencesis_https
Tests:
- Remove
health_path_returns_200_regardless_of_hosttest - Remove
health_with_unknown_host_returns_200test - Update
make_proxy_statehelper — removeis_httpsfield - Update
inject_proxy_headerstests — removeis_httpsparameter, verifyX-Forwarded-Protois always"https" - The health check endpoint on port 9900 remains independently tested in
src/health.rs
Acceptance Criteria
- No
/healthroute on the main HTTPS listener ProxyStatestruct no longer hasis_httpsfieldinject_proxy_headersalways setsX-Forwarded-Proto: https(no parameter)- Code comment explains why
X-Forwarded-Protois always"https" proxy_handlerhas no special-case path matching before Host lookup- Port 9900 health check (
src/health.rs) is unchanged and working - All existing tests pass (minus removed health-on-main-listener tests)
cargo clippypasses with no warnings
References
- docs/architecture/decisions/022-health-check-scope.md — ADR-022
- docs/architecture/proxy.md — updated request flow (no /health route)
- docs/architecture/operations.md — health check is port 9900 only
- docs/reviews/002-implementation-review.md — W5, W14 findings
- docs/architecture/open-questions.md — OQ-08, OQ-11
Notes
To be filled by implementation agent
Summary
To be filled on completion