RELAYLINK

HTTP reverse proxy design

Document ID: DES-008
Status: Draft
Version: v1.5.0
Updated: 2026-10-15
Research Date: 2026-10-12
Related: REQ-001N, ADR-0026, Peer Direct & Relay Fallback (DES-011)

Implementation status: Protocol v5 HTTP/HTTPS reverse proxying is running on main, including the target Agent's Kestrel/YARP virtual ingress, Host/Origin policies, public browser TLS pass-through, and inner TLS for authorized peer access. This document retains Draft status because the option evaluation in Section 2, PoC thresholds, and unmeasured production capacity figures remain design records rather than accepted production facts. Operational steps live in the HTTP/HTTPS Reverse Proxy Guide, and repeatable local evidence is tracked in the HTTP Verification Record.

1. Conclusions & Current State

HTTP parsing, ingress TLS termination, Host/Origin policy enforcement, and Web upstream connections are consolidated inside the target RelayLink.Agent. RelayLink.Server continues to own channel configuration, authentication, authorized mappings, source-IP ACLs, tunnel pairing, quotas, and auditing—without parsing HTTP. The caller Agent retains local TCP ingress and encrypted peer access without introducing YARP. Existing raw TCP/UDP paths remain intact.

The target Agent embeds a dedicated Kestrel + YARP IHttpForwarder host backed by an in-memory Kestrel virtual transport with no OS listening socket:

  • Public HTTPS: The browser performs the TLS handshake directly with the target Agent's ingress certificate while the Server relays ciphertext.
  • Encrypted Peer HTTP/HTTPS: Existing inner TLS and access-proof verification complete first, after which browser bytes are handed to the virtual HTTP ingress. Peer HTTP channels require endToEndEncryptionEnabled=true and strictly enforce peerRoutingPolicy=relayOnly (never switching to P2P direct QUIC/ICE-TCP; see DES-011).

Real Server/Agent integration across all four ingress modes is implemented, with repeatable local evidence in HTTP Verification. Dedicated virtual-ingress tests cover TLS, WebSocket, streaming, origin/host validation, quotas, and zero-replay on failure; these results do not establish production throughput or browser compatibility for arbitrary third-party Web apps.

On existing paths, ControlSessionWorker connects to the raw target socket and PeerSessionCoordinator connects to the target after inner TLS and access proof succeed. In HTTP mode, both paths route into the target Agent's internal virtual HTTP ingress instead of opening a raw socket to the Web upstream directly. The Server wire protocol supports v3/v4/v5: v5 adds HTTP config, trusted context, and readiness frames, while snapshots sent to legacy Agents strip HTTP additions so older versions continue handling raw channels as before.

2. YARP & Hosting Evaluation

Option Assessment Decision
Target Agent Kestrel + IHttpForwarder Shared policy across both access modes; decryption at target; fixed target needs no cluster routing Adopted
YARP on Server Cannot uniformly rewrite HTTP while keeping peer ciphertext relay; places ingress private keys on Server Rejected
YARP on both Agents Duplicates policy, burdens caller Agent, and introduces double HTTP translation Rejected
Plain HTTP proxy port on target Agent loopback Simple hosting, but local host processes could bypass mapping authorization and mix contexts Not default; PoC baseline only, never shipped
Kestrel custom connection listener / virtual EndPoint Feeds authorized Stream / IDuplexPipe and trusted connection features directly with zero local bypass port Implemented & tested
Custom HTTP parser or full YARP cluster pipeline High protocol/security cost for custom parser; duplicates RelayLink config/routing for full cluster pipeline Rejected

This design pins Yarp.ReverseProxy 2.3.0, which supports .NET 8+ under the MIT license and is referenced directly by the Agent project (YARP v2.3.0 Release).

  • IHttpForwarder uses a dedicated HttpMessageInvoker and request transformers, supporting streaming responses and WebSockets. Routing is fixed by the channel, so the target Agent connects only to its local/private Web upstream rather than opening tunnels via Server ConnectCallback (YARP Direct Forwarding).
  • IConnectionListenerFactory binds a custom EndPoint, and ConnectionContext provides IDuplexPipe Transport, connection features, cancellation, and disposal. The virtual transport uses a self-managed CancellationTokenSource on ConnectionContext to avoid async Abort/Dispose races present in DefaultConnectionContext. Stream-to-Pipe bridging, nested TLS, and close semantics rely on project test evidence rather than API documentation alone (IConnectionListenerFactory, ConnectionContext).

3. Two Data Paths

3.1 Public Access

flowchart LR
    B["Browser HTTP / HTTPS"] --> S["Server Channel TCP Ingress / ACL"]
    S -->|"Bound Payload Stream"| A["Target Agent Authorized Stream"]
    A --> K["Kestrel HTTP / Browser TLS Termination"]
    K --> Y["YARP / Origin Check / Host & Origin Transform"]
    Y --> T["Fixed HTTP / HTTPS Web Upstream"]

A dedicated Server port binds a fixed clientId/channelId, enforcing source-IP security groups, online/capability/readiness checks, connection and pending quotas, and audit gates. It never selects targets by Host and never terminates browser TLS. Control messages establish HTTP mode, entry scheme, policy version, and source context up front; bind tokens remain strictly single-use.

After verifying the channel's active policy version, local resource availability, and connection lease, the target Agent reports HttpIngressReady (type=24). This frame indicates only that the virtual proxy ingress is ready—not that the Web upstream is reachable. Once the Server audit succeeds, it sends Start and the Agent hands the raw payload stream to Kestrel. HTTPS handshakes happen at the target Agent, and upstream HTTP connections are initiated by YARP only after request validation. Standard raw TargetReady socket semantics must not be reused for HTTP.

3.2 Encrypted Peer Access

flowchart LR
    B["Browser HTTP / HTTPS"] --> C["Caller Agent Loopback TCP Ingress"]
    C -->|"Agent Inner TLS Ciphertext"| S["Server Auth & Frame Relay"]
    S -->|"Ciphertext"| A["Target Agent / Inner TLS & Access Proof"]
    A --> K["Kestrel HTTP / Optional Browser TLS"]
    K --> Y["YARP / Unified Channel Policy"]
    Y --> T["Fixed HTTP / HTTPS Web Upstream"]

Peer access follows PeerOpen -> dual PeerBindData -> inner TLS -> random challenge/HMAC access proof:

  • Mandatory E2E Encryption & Relay-Only: Peer HTTP channels require endToEndEncryptionEnabled=true and strictly enforce peerRoutingPolicy=relayOnly (never using preferDirect P2P QUIC or ICE-TCP), preserving Server-mediated connection orchestration, proof checks, and frame relay.
  • Application Record Unframing: After the access proof succeeds, PeerApplicationStream unframes the existing 4-byte length-prefixed application records inside inner TLS and passes browser bytes to the virtual HTTP ingress without dialing the Web target up front. The caller Agent copies browser bytes verbatim without rewriting Host/Origin or decrypting browser HTTPS. When the browser uses HTTPS, inner TLS carries an independent browser TLS stream that Kestrel terminates on the target Agent.
  • Ingress Ready Marker (byte=2): While raw peer channels preserve byte=1 for target socket readiness, the v5 HTTP branch sends byte=2 inside inner TLS once the target Agent confirms host resources and connection quotas. The caller Agent consumes the complete readiness result before forwarding browser bytes. The target must never wait for the browser TLS handshake or the first HTTP request before signaling readiness, as that would deadlock both ends. Similarly, public HttpIngressReady precedes Start, leaving browser TLS as an independent time-bounded stage on the active connection.
  • Context-Bound Access Proof: Access proof contexts are domain-separated and bind applicationProtocol, HTTP policy digest/version, mappingId, entry scheme, and confirmed external authority to prevent cross-mode or cross-entry confusion under the same key. Both caller mapping and target snapshot must match—validation cannot stop at Server pairing. New fields and frames are versioned explicitly without silently altering legacy proof calculations.
  • Mutually Exclusive Boundaries: authorizedClientsOnly isolation remains intact—public channels have no peer mappings, and authorized peer channels open no Server proxy listening port. A single Web target may be exposed via two separate channels (one public, one peer) sharing the Agent HTTP engine while keeping configs, quotas, and pools isolated.

4. Virtual HTTP Ingress & Connection Identity

The target Agent runs a dedicated business host completely separate from the local Agent status dashboard routes. Virtual EndPoint instances are keyed by serverProfileId/channelId/activePolicyVersion/entry scheme. Every authorized connection carries an immutable context:

  • connectionId, target client, channel, config version, accessKind, entry scheme
  • Public sourceIp, or peer callerClientId, mappingId, and confirmed mapping authority
  • channelId sourced exclusively from the handshake and snapshot—never from HTTP paths or headers

Stream ingestion and request isolation rules:

  • Bounded Ingress Queue: Authorized streams convert to ConnectionContext.Transport through a bounded queue capped at min(channel maxConnections, 32). Enqueue runs non-blocking after Start (public) or byte=2 readiness (peer); if full, the stream is aborted immediately—readiness never promises future request capacity, preventing unbounded pending queues.
  • Bidirectional Stream-to-Pipe Bridging: Both directions enforce cancellation, bounded buffering, backpressure, EOF, and Abort propagation. Bind frames, inner TLS challenges/proofs, and private metadata prefixes must never leak into the HTTP parser, nor may pre-reads drop ClientHello or initial HTTP bytes.
  • Strict Protocol Framing: Public streams start as raw business bytes immediately after Start; peer streams begin after the access proof and byte=2 marker as unframed PeerApplicationStream payloads inside inner SslStream. HTTPS virtual ingresses run Kestrel TLS directly without first-packet sniffing or client-driven scheme switching. Phase 1 constrains both ingress and upstream to HTTP/1.1 (disabling HTTP/2 and HTTP/3) so multiplexing does not alter resource or context boundaries.
  • Per-Request Revalidation: Every request—including subsequent requests on a keep-alive connection—reads identity, active policy version, and true external entry metadata from its ConnectionContext to revalidate Host/Origin. Validation must never occur only on the first request, nor infer public vs. peer mode from forwarded headers. Because the virtual host opens no LAN or loopback socket, unknown local processes cannot bypass authorization to call the proxy directly.

5. TLS Segmentation & Certificate Deployment

Scenario / Segment TLS Termination & Protection Scope Notes
Public HTTPS: Browser -> Server -> Target Agent Browser TLS terminates at target Agent Kestrel Server relays ciphertext; standard tunnel payload protected by browser TLS
Public HTTP: Browser -> Server -> Target Agent No browser TLS Plaintext; avoid for sensitive public deployments (control TLS does not cover data)
Peer HTTP: Caller Agent -> Server -> Target Agent Existing inner TLS terminates at target Agent Preserves pinned Agent identity & access proof; loopback browser hop is HTTP
Peer HTTPS: Browser -> Target Agent Browser TLS nested inside Agent inner TLS, terminated at target Agent Kestrel Both layers verified independently; inner TLS cannot be disabled
Target Agent -> HTTPS Web Upstream Agent SocketsHttpHandler initiates and validates upstream TLS Independent of ingress certs and Agent peer identity
Target Agent -> HTTP Web Upstream No TLS Trusted target segment only; peer TLS does not extend to the Web server

Trust and deployment boundaries:

  • Server Visibility: Not decrypting HTTPS traffic does not make deployments opaque to the Server—public HTTP is plaintext, and the Server still observes source, channel, and connection metadata. Plain data bind tokens also remain outside browser TLS and require minimal exposure on protected networks. The target Agent is a trusted HTTP endpoint that sees plaintext; RelayLink does not claim a single unbroken E2E TLS tunnel from browser to Web server. Upstream HTTPS and Host/SNI behavior follow YARP HTTPS/TLS documentation.
  • Public Certificates & Intermediate Chains: Domain certificate private keys are pre-provisioned on the target Agent; the Server stores only certificateRef, and control snapshots carry resource IDs without private keys. Resources are isolated per serverProfileId and resolved strictly from fixed directories via allowlisted IDs—arbitrary filesystem paths in snapshots are rejected. Ingress PEM files place the leaf certificate first followed by intermediate CA certificates, which are imported separately into Kestrel ServerCertificateChain so chains never depend on OS trust or AIA fetching. Validity and CA constraints are checked on load. Existing self-signed Agent inner-TLS identities are never reused as browser-trusted HTTPS certs. Renewal uses deployment tooling plus Agent restart; RelayLink performs no ACME auto-issuance, global root installation, or validation bypass.
  • Peer HTTPS Hostnames & Trust: The browser hostname configured in peerAuthorityHost must resolve to caller 127.0.0.1 and appear in the target Agent ingress certificate SAN (e.g., https://panel.peer.example.test:<port>/ via local DNS/hosts, or an internal CA cert with localhost/IP SANs). Ports do not enter SANs but are enforced in Host/Origin allowlists. Trusting the Agent peer certificate thumbprint does not make browsers trust the ingress certificate; the caller OS must trust the ingress issuing chain, without automatic OS trust or hosts edits.
  • Physical Target vs. Logical Upstream: Ingress and upstream schemes are independent. The target Agent always dials the physical targetHost:targetPort while upstreamAuthority defines the HTTP Host and TLS server name. ConnectCallback opens the raw socket to the physical target and lets SocketsHttpHandler negotiate TLS against the logical URI so logical hostnames never resolve to unintended targets. In Phase 1, the effective HTTPS upstream Host must match the logical authority host and effective port; mismatched preserve/fixed configurations are rejected rather than bypassing certificate validation. Split HTTP Host vs. TLS SNI configurations are deferred to future review.

6. Original Host, Origin & Trusted Forwarded Headers

Requests on the target Agent follow a strict pipeline: verify connection authorization & active version -> extract original entry scheme/Host -> validate original Host/Origin -> strip incoming forwarded headers -> transform Host/Origin -> connect to fixed Web upstream. Origin checks must evaluate the incoming request before fixed replacement. Because the Server cannot inspect Origin before tunneling HTTPS, invalid origins receive 403 from the target Agent after HTTP parsing—still without touching the Web upstream.

Policy Target Agent Behavior Constraints
hostMode=upstream (default) Derives fixed logical upstream Host Must match HTTPS upstream name
hostMode=preserve Preserves validated ingress Host Bounded by public/peer allowedAuthorities; matches HTTPS name
hostMode=fixed Replaces with configured authority No path/userinfo/CRLF/multi-value; matches HTTPS name
originMode=preserve (default) Preserves valid Origin or absence Public/peer allowlist must be non-empty; present values must match; WS rejects missing Origin
originMode=fixed Matches ingress allowlist first, then replaces with fixed Origin Allowlist non-empty, no wildcards; non-WS missing stays absent, WS missing rejected

Header and origin rules:

  • Origin Normalization: Matches exact scheme, case-insensitive DNS host, and effective port with no path, query, fragment, or userinfo. Rejects null, comma-separated multi-values, invalid encoding, CRLF, and suffix wildcards. Public channels require explicit origins; peer channels accept entry to derive the single confirmed origin from mapping authority and peerEntryScheme (never a wildcard for arbitrary localhost ports). When a mapped port rotates, the new context is confirmed first and old connections/origins are revoked; the caller status UI displays the active URL without altering browser Origin.
  • Dual-Mode Convergence: Public and peer channels define separate allowed ingress sets while sharing the target channel's hostMode/originMode rewrite rules. For example, public access may allow https://panel.example.test and peer access http://127.0.0.1:<port>, both rewriting cleanly to upstream Host=127.0.0.1:18789 and Origin=http://127.0.0.1:18789. Unknown sites receive 403. Note that Origin can be forged by non-browser clients and never replaces access proofs or Web authentication.
  • Forwarded Header Stripping & Reconstruction: All incoming Forwarded and X-Forwarded-* headers are stripped alongside client-supplied X-Real-IP, True-Client-IP, X-Client-IP, and CF-Connecting-IP. stripRequestHeaders appends exact header names (clearing it never restores the built-in strip list). X-Forwarded-Host and X-Forwarded-Proto are then rebuilt from the trusted connection context and actual ingress request. Public X-Forwarded-For carries the Server-observed source IP bound via control context; peer mode never fabricates a browser IP or forwards spoofed For headers, recording callerClientId in structured context and logs instead. Context metadata is never injected as PROXY protocol. The Server remains a trusted coordinator—source IP assertions do not defend against a compromised Server, nor does peer privacy protect against a compromised control plane.
  • Pass-Through Boundaries: Referer is preserved; RelayLink does not synthesize CORS responses or rewrite Location, Set-Cookie, CSP, HTML, or absolute URLs. Target apps keep their own authentication, and base URLs, cookies, CSRF, and secure browser contexts must be tested against the real application (YARP Request Transforms).

7. WebSocket, Upstream Pooling & Resource Lifecycle

  • WebSocket Support: YARP handles HTTP/1.1 Upgrade and bidirectional streaming across all four ws/wss and HTTP/HTTPS upstream combinations. Original Host/Origin and quotas are checked prior to upgrade; frames and Sec-WebSocket-* headers pass unmodified afterward. WebSocket detection parses comma-separated, case-insensitive Upgrade tokens (trimmed), ensuring websocket, foo and duplicate headers undergo Origin validation and WebSocket idle timeouts. An empty Origin allowlist always rejects WebSockets, including same-origin requests. HttpMessageInvoker disables full response buffering and sets UseProxy=false, UseCookies=false, AllowAutoRedirect=false, and AutomaticDecompression=None (YARP WebSockets).
  • Upstream Pool Isolation: Each frontend TCP connection maps to one public tunnel or peer session carrying sequential HTTP requests; the upstream pool lives on the target Agent, distinct from the tunnel pool. Pools isolate by serverProfileId/channelId/activePolicyVersion, logical upstream authority, and trust policy so requests never inherit another caller's identity. Upgraded WebSocket upstream connections are exclusive and never return to the pool.
  • Defaults & Quotas: Server and both Agents preserve tunnel/pending quotas and audit gates; the target Agent enforces additional HTTP concurrency, upstream pool, and ingress queue budgets (idle pooled slots still count toward upstream connection limits). Defaults are: 32 KiB total headers, 30 MiB request body, 15s header read timeout, 15s browser TLS handshake timeout, PooledConnectionLifetime=TimeSpan.Zero (no cross-request reuse), 60s client idle constraint, 120s normal streaming activity idle timeout, and 300s WebSocket activity idle timeout. HTTP requests and upstream connections cannot exceed the channel maxConnections. When maxWebSocketConnections is 0, WebSockets share the channel limit; positive values tighten WebSocket concurrency below maxConnections so long-lived sockets cannot starve regular HTTP requests into 503. These are implementation defaults, not capacity proof.
  • Stage Timeouts & Long-Lived Streams: Tunnel setup uses openTimeoutSeconds; peer inner TLS/proof and target ingress TLS have separate stage deadlines so chained stages cannot bypass pending limits. Streaming write timeouts, bounded buffers, cancellation, Pipe completion, and TLS close/EOF propagation require dedicated validation—raw socket Shutdown(Send) must not be applied blindly to virtual pipes or nested SslStream. SSE and WebSocket requests omit short total request timeouts. WebSocket activity idle defaults to 300s (range 0–86400), where 0 is allowed only on peer channels for explicit unlimited idle and rejected on public channels (falling back to 300s at runtime if ever encountered). Long-lived connections remain governed by outer control session liveness and revocation (YARP Timeouts).
  • Single Delivery & No Replay: Request cancellation releases request budget; tunnel, inner TLS, virtual connection, and upstream ownership each terminate once under lease control. Disconnects, revocations, active version changes, and host stops drain and clear affected queues, connections, and upstream pools without replaying or resuming old sessions. Because YARP's lack of retries does not prevent internal connection-pool retries on stale connections, Phase 1 enforces HTTP/1.1 with PooledConnectionLifetime=TimeSpan.Zero. Fault-injection tests aborting the upstream after receiving GET/POST confirm single delivery (502 returned, request count = 1). Re-enabling pooling later requires dedicated zero-replay evidence (PooledConnectionLifetime).

8. Centralized Configuration, Capabilities & Activation

Configuration models, validation, v5 protocol extensions, and runtime integration are implemented. See the sanitized example in http-client.example.json (HTTP channels are disabled by default; valid config syntax alone does not imply runtime readiness). Implementation uses flat fields under HttpProxyOptions (hostMode/hostValue, originMode/originValue, and limit properties directly under http).

Field Semantics
channel.applicationProtocol raw (default) or http; http requires transportProtocol=tcp and forces peerRoutingPolicy=relayOnly on peer channels
channel.http.publicEntryScheme / peerEntryScheme http or https, active only for the selected access mode
channel.http.publicAllowedAuthorities / publicAllowedOrigins Exact allowed public ingress authorities and origins; public Origin list must be non-empty
channel.http.peerAuthorityHost / peerAllowedOrigins Loopback-resolving local DNS name or 127.0.0.1; entry derives the confirmed mapping scheme/host/port; list must be non-empty
channel.http.certificateRef / upstreamTrustRef Restricted resource IDs on target Agent; reference-only, never distributes private keys or CA secrets
channel.http.upstreamScheme / upstreamAuthority Fixed Web upstream scheme and logical authority; physical endpoint continues using targetHost/targetPort
channel.http.hostMode / hostValue, originMode / originValue Host/Origin transform rules shared across public and peer entry paths
channel.http.maxRequestBodyBytes / maxRequestHeaderBytes / headerTimeoutSeconds / activityTimeoutSeconds / webSocketActivityTimeoutSeconds Body 1–1 GiB, headers 1–64 KiB, header timeout 1–300s, activity 1–3600s, WS default 300s (0–86400; 0 forbidden on public channels)
channel.http.maxWebSocketConnections 0 inherits channel maxConnections; positive value caps concurrent WebSockets (<= maxConnections)
channel.http.stripRequestHeaders Up to 32 additional exact header names stripped beyond built-in Forwarded, X-Forwarded-*, and the 4 client IP headers
mapping derived fields Application mode, peer scheme, URL host, bound local port, and policy version—never duplicated manually

Distribution, compatibility matrix, and restart-based activation:

  • Minimal Exposure: Only the target Agent snapshot carries full HTTP policy and resource references. Caller Agents receive only authorized mappings, mode, peer scheme/authority, version, and existing keys/target identity—never upstream credentials or ingress private keys. Control connections always require TLS in HTTP mode.
  • Wire v5 Boundaries: Protocol v5 adds HTTP capabilities, snapshot representation, httpIngress context on Open/PeerOpen, and readiness frames. Single-use data bind tokens must match the session version. Target Agents receiving HTTP mode never fall back to raw socket dialing, and capabilities are never inferred from AgentVersion strings. Snapshot digests and peer proofs include HTTP mode and policy version domains; legacy serialization strips new fields and unsupported channels/mappings per ADR-0025.
Server / Agent Combination Raw TCP/UDP HTTP
New Server + Legacy v3/v4 Agent Supported per existing matrix HTTP channels/mappings omitted; Admin UI shows insufficient capability; no silent raw downgrade
New Server + New Target Agent Unchanged Public ingress supported once policy, readiness, and resources match
New Server + New Caller & Target Agents Unchanged Encrypted peer access supported (forced relayOnly) when modes/versions align
Either Peer Agent Lacks HTTP Capability Existing raw unaffected HTTP mapping rejected; never falls back to plaintext or public ingress
Legacy Server + New Agent Automatic downgrade not promised Unsupported; always upgrade Server before Agents
  • Restart-Based Activation & HttpStatus (type=23): Channel policy is managed solely by the Server. On reconnect, the Agent fetches the desired snapshot, but each HTTP host activates its policy and certificates only on the initial snapshot after that profile's Worker starts—there is no hot reload. If a new HTTP policy arrives, or a channel is disabled or removed while running, the target Agent removes the host from its table, stops its WebApplication, disposes HttpMessageInvoker and certificates, and reports restart_required. Host preparation and admission are locked; late arrivals against a disposed host become protocol or I/O errors without leaking unhandled ObjectDisposedException. HttpStatus (type=23) reports desired policyHash alongside:
    • ready: Virtual ingress host for that policyHash is active;
    • resource_unavailable: Ingress certificate, trust material, or host load failed (isolated per channel with specific failure category; never swaps certs or disables TLS);
    • restart_required: Desired policy differs from the running frozen policy or was revoked; requires restarting the target Agent (ConfigAck confirms receipt only, never HTTP readiness).
  • Explicit Rebuild & Prohibitions: Peer scheme, hostname, or policy changes require restarting the caller Agent to activate updated mappings; port-collision rotation keeps HTTP ingress closed until the new port and entry context confirm. Disabling/re-enabling or replacing config in the local Agent UI rebuilds that profile's Worker and activates HTTP cleanly; normal control reconnects do not hot-reload HTTP hosts. HTTP forbids UDP, forbids disabling peer inner TLS, enforces peerRoutingPolicy=relayOnly, and never treats EndToEndEncryptionEnabled as public-tunnel TLS. Config workflow remains validate -> backup -> restart -> verify readiness (HTTP Operations Guide); UI pages expose read-only mode, status, and URLs without HTTP policy write forms.

9. Failures, Traffic Accounting & Logging

  • Error Ownership: The Server emits no HTTP responses—offline Agents, insufficient capabilities/readiness, bind failures, or ACL rejections close the connection prior to TLS/HTTP handling so plaintext 503 bytes never corrupt an HTTPS handshake. Target Agent Kestrel/YARP returns 400 (malformed headers), 421 (disallowed Host), 403 (rejected Origin), 413 (body limit), 503 (request quota full), 502 (upstream connect/TLS failure), and 504 (upstream timeout), or aborts the stream once response/upgrade bytes have started. Ingress certificate or TLS handshake failures terminate at TLS.
  • Byte Accounting: Server traffic meters follow raw tunnel and peer relay payload bytes—public HTTPS includes browser TLS overhead, and peer HTTPS includes two TLS layers, neither matching HTTP body size. The target Agent records per-request status code, duration, cancellation, channel, tunnel connectionId, and callerClientId/mappingId without adding unimplemented Server HTTP counters; multiplexed requests on a keep-alive tunnel keep distinct caller contexts. Detailed HTTP status stays in redacted Agent logs and read-only views so the Server never decrypts or inspects bodies.
  • Redacted Logging & Read-Only UI: Full URLs, query strings, and headers are off by default; Authorization, Cookie, secrets, private keys, bodies, and WebSocket payloads are never logged. Both UIs explicitly surface http/https, active URLs, encryption posture, capability flags, and desired/active/readiness state—never claiming HTTP availability from TCP online status alone.

10. Verification Gates & Uncovered Scope

Core verification gates (see HTTP Verification Record for current local test evidence and HTTP Operations Guide for deployment steps):

  1. Real public/peer authorized Stream -> custom Kestrel Transport with zero local bypass, zero prefix/pre-read byte corruption, and zero cross-channel/profile context leaks across multi-request keep-alive, queue saturation, cancellation, EOF/half-close, and stop/disposal.
  2. Public HTTP/HTTPS and peer HTTP/HTTPS four-way matrix; capture Server-relayed ciphertext to verify target-side TLS termination, mandatory peer encryption, peerRoutingPolicy=relayOnly, and resistance to origin/mapping spoofing.
  3. Browser ingress certificates, loopback name resolution, and dynamic port/entry derivation; independent verification of Agent peer identity, browser ingress chain, and upstream Web trust (SNI/Host/logical URI and rejection of wrong-name, expired, or unknown-CA certs).
  4. Negative Host/Origin/forwarded-header tests on both ingress paths, ws/wss subprotocols, graceful close, nested TLS, SSE streaming, slow I/O, uploads, and single-delivery replay checks; real Web app CSRF, login, redirects, cookies, and secure context behavior.
  5. Mixed Server/Agent version matrix, snapshot digests, domain-separated HTTP access proofs, restart_required/HttpReady transitions, port rotation, audit failures, quota saturation, disconnects, pool expiry, and fault cleanup.
  6. Cross-platform validation across Windows/Linux Servers and Windows/Linux/macOS (Intel/Apple Silicon) Agents, evaluating binary size, ASP.NET Core runtime dependencies, and memory footprint.

Production Web app login/CSRF/redirect/cookie behavior, sustained load testing, and real-network packet captures require validation in the target environment rather than local echo fixtures or CI alone. Evidence coverage and open gaps for acceptance criteria A85–A91 are tracked separately without prematurely marking REQ-001N as Done.

Repository source