RELAYLINK

HTTP/HTTPS reverse proxy guide

Document ID: OPS-003
Status: Active
Version: v1.3.0
Updated: 2026-11-29
Related: Requirements, Design, Verification

1. Upgrade and Configuration

Upgrade the Server first, then upgrade the target Agent; for peer access, also upgrade the caller Agent. HTTP reverse proxying requires wire protocol v5 and control TLS (tunnel.tlsEnabled = true). HTTP peer channels always enforce endToEndEncryptionEnabled=true and peerRoutingPolicy=relayOnly—configuration validation rejects disabling inner encryption or setting preferDirect on HTTP channels. The upgraded Server preserves v3 TCP and v4 TCP/UDP compatibility; legacy Agents never receive HTTP channels or mappings and will not run them as raw streams. Newer Agents do not automatically downgrade when connecting to older Servers.

The Server's client configuration remains the single source of truth for channels. Start from http-client.example.json and http-caller-client.example.json, replacing the registration secret, channel access secret, and pinned target Agent E2E certificate fingerprint. Example configs contain placeholder values and have HTTP channels disabled by default—never deploy them unmodified.

Expose public and peer access to the same web target via two separate channels: web-public with authorizedClientsOnly=false (Server listens on a public/LAN port), and web-private with authorizedClientsOnly=true (accessed only via peer mappings with no Server business port opened). Physical targetHost/targetPort are fixed and dialed by the target Agent, while http.upstreamAuthority specifies the logical Web Host and HTTPS validation name—targets are never selected from the browser's Host header.

Configure HTTP rules under http using hostMode/hostValue and originMode/originValue. Public allowlists use the actual ingress authority and Origin, including non-default ports such as panel.example.test:19443. Both publicAllowedOrigins and peerAllowedOrigins must be non-empty: both public and peer channels accept WebSocket upgrades, so empty lists fail validation rather than allowing arbitrary origins. On peer channels, peerAllowedOrigins=["entry"] derives the single exact origin from the confirmed mapping scheme, host, and dynamically assigned local port rather than wildcarding arbitrary localhost ports. Using originMode="fixed" still requires a non-empty allowlist; normal requests without an Origin header are not synthesized, whereas WebSocket requests missing Origin are rejected. When a comma-separated or multi-value Upgrade header contains any websocket token (case-insensitive), WebSocket Origin checks apply.

webSocketActivityTimeoutSeconds defaults to 300 (range 0–86400). Public channels forbid 0, whereas peer channels may explicitly set 0 to disable idle closure. When maxWebSocketConnections is omitted or 0, the channel's maxConnections applies; set a smaller positive integer to reserve capacity for regular HTTP requests. stripRequestHeaders appends exact header names to remove (up to 32); Forwarded, X-Forwarded-*, X-Real-IP, True-Client-IP, X-Client-IP, and CF-Connecting-IP are always stripped.

The Admin Web UI displays HTTP mode, readiness status, and entry URLs without an HTTP policy editor form. Editing an existing channel preserves ApplicationProtocol=http rather than silently reverting to raw; changing target or runtime parameters still marks the HTTP host as requiring restart. Create or update HTTP policies by editing Server JSON, running --check-config, backing up state, and restarting affected processes.

2. Target-Agent Resources

Resource files live on the target Agent under state/{profileId}/http-resources beside that profile's identity.pfx:

Config Reference Target-Agent Files Purpose
certificateRef=panel panel.crt.pem, panel.key.pem Public ingress certificate and private key
certificateRef=peer-panel peer-panel.crt.pem, peer-panel.key.pem Peer browser ingress certificate and private key
upstreamTrustRef=web-ca web-ca.ca.pem Custom root CA bundle for HTTPS upstreams

Each ingress .crt.pem must place the leaf certificate first followed by any intermediate CA certificates required for deployment, paired with its matching .key.pem. The Agent passes the intermediate chain to Kestrel via ServerCertificateChain rather than relying on server OS trust or AIA fetching. All certificates and CA bundles must be currently valid.

Resource IDs accept only restricted lowercase letters, digits, underscores, and hyphens—no paths. Certificates and private keys must match, be within their validity period, and include SAN coverage for allowed ingress hostnames; missing, mismatched, or invalid materials report resource_unavailable. Custom trust bundles accept only CA certificates without private keys; omitting upstreamTrustRef falls back to system trust, and HTTPS upstreams always validate chain and hostname against upstreamAuthority.

Grant the Agent service account read-only access and block other users from private key directories; certificates and private identities must never be committed to Git or pushed through control snapshots. To renew certificates, back up and replace files on the target Agent, restart the target Agent, and verify the updated status. Never delete or replace identity.pfx to renew browser certificates—the two identities are independent.

For peer HTTPS, peerAuthorityHost must resolve to the caller's IPv4 loopback (127.0.0.1) and appear in the ingress certificate's SANs. Local peer entries bind IPv4 loopback only and do not accept IPv6 or non-127.0.0.1 IP literals. When using localhost or an internal CA certificate containing 127.0.0.1 in SANs, the caller's browser must trust that issuing chain; custom domain DNS/hosts entries are managed by the operator. RelayLink never modifies OS trust stores or hosts files, and pinning the Agent E2E fingerprint does not grant browser TLS trust.

3. Activation and Read-Only Status

Validate edited Server configs with --check-config per the Installation and Usage Guide, back up existing configs and resource files, restart the Server and relevant Agents, and inspect status. Saving JSON or receiving ConfigAck alone does not activate HTTP hosting.

The target Agent loads HTTP virtual hosts and resources upon receiving its initial snapshot for a profile worker. Policy changes, re-adding revoked channels, or adding new HTTP channels during runtime require restarting the target Agent (or explicitly recreating that profile worker); peer HTTP mapping changes require restarting the caller Agent (or explicitly recreating its worker). Ordinary control-session reconnects do not hot-reload HTTP policies or certificates. Disabling/re-enabling or import-replacing a profile in the local Agent UI recreates that single profile worker without affecting other profiles and counts as an explicit restart. Raw TCP/UDP channels continue using existing live config mechanics.

HTTP Status Meaning Action
ready Ingress host for the reported policyHash is active Ready for requests; upstream connectivity failures may still occur
resource_unavailable Ingress cert, trust bundle, or host failed to load Fix deployed resource files and restart the target Agent
restart_required Desired policy differs from frozen active host or was revoked Restart the relevant Agent and re-check status
No status Agent offline, legacy Agent lacks HTTP support, or channel disabled Check enabled flag, protocol version, and control connection

Agent /api/v2/status reports per-profile channel HTTP states and entry URLs; a caller URL only confirms the local loopback listener is bound—end-to-end reachability must still be verified with a real request. Server read-only snapshots mark HTTP channels available only when target readiness matches; online control status alone is insufficient. Always use the dynamically reported port rather than stale bookmarks.

4. Local and Workload Verification

Verify actual responses across all four ingress modes: public HTTP, public HTTPS, peer HTTP, and peer HTTPS. Test HTTPS with real certificate trust and hostname verification rather than skipping validation. Upstream captures should observe the expected rewritten Host/Origin; requests with an unknown Origin must return 403 and unknown Host must return 421 without dialing the web upstream. Test ws/wss subprotocols, bidirectional frames, and close behavior; verify SSE/streaming downloads deliver first chunks before response completion.

The Server does not parse HTTP. When an Agent is offline or ACL, capability, or readiness checks fail, the Server closes the TCP connection before HTTP/TLS rather than injecting a plaintext 503. At the target Agent, rejected origins return 403, oversized bodies return 413, and upstream TLS or dial failures return 502. Default limits are 15s header/browser TLS handshake timeout, 30 MiB request body, 32 KiB headers, 120s normal activity idle timeout, and 300s WebSocket activity idle timeout. Control disconnects, revocations, or policy changes terminate active streams and release the HTTP host; changed channels remain restart_required until the relevant Agent restarts.

Version 1 does not pool upstream HTTP connections (HTTP/1.1 with PooledConnectionLifetime=TimeSpan.Zero) to avoid internal retries on stale pooled sockets; each normal HTTP request opens a fresh upstream TCP/TLS connection, while upgraded WebSockets reuse their dedicated connection. This trade-off has not been load-tested for high-concurrency capacity. Passing synthetic echo checks does not guarantee compatibility with a real application's cookies, public base URLs, logins, CSRF checks, Referer rules, redirects, or browser security contexts—RelayLink does not rewrite response bodies or headers.

See HTTP Verification for repeatable automated test commands, process isolation, and cleanup steps. Failure logs record only channel, connection, caller/mapping, status code, duration, and cancellation—never URL query strings, Authorization headers, cookies, payloads, or private keys.

Repository source