Skip to content
MoliSync
Documentation menu
Documentation Reverse proxy

Reverse proxy & mTLS

MoliSync trusts identity headers only from configured proxy CIDRs. The proxy must verify the client certificate, strip any inbound identity headers and then set fresh values.

Trust order

  1. Terminate TLS and request a client certificate.
  2. Verify the certificate chain and, where applicable, revocation.
  3. Remove inbound X-Client-* headers.
  4. Set the verified result, fingerprint and subject from the proxy's own variables.
  5. Forward WebSocket upgrades and disable request and response buffering.

Nginx example

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_request_buffering off;
proxy_buffering off;

proxy_set_header X-Client-Verify $ssl_client_verify;
proxy_set_header X-Client-Fingerprint $ssl_client_fingerprint;
proxy_set_header X-Client-DN $ssl_client_s_dn;

Map the headers

Tell the control plane which header names it should read:

VariableValue in the example
MOLISYNC_PROXY_VERIFY_HEADERX-Client-Verify
MOLISYNC_PROXY_FINGERPRINT_HEADERX-Client-Fingerprint
MOLISYNC_PROXY_DN_HEADERX-Client-DN

Network boundary

Only the proxy and the control plane should join molisync-internal (subnet 172.28.0.0/24 in the example). Keep MOLISYNC_PROXY_TRUSTED_CIDRS as narrow as that network allows.

Caution

Anyone who can reach the service on the trusted network can forge identity headers. Never expose the Go service directly to the public internet, and never let clients join that network.

Checklist

  • Client certificate verification enabled and tested with a trusted certificate.
  • Inbound X-Client-* headers stripped at the edge.
  • MOLISYNC_PROXY_TRUSTED_CIDRS matches only the proxy network.
  • WebSocket upgrade and streaming (no buffering) verified.
  • Health check still points at the real listen port.