Reverse proxy
The control plane serves plain HTTP. Something has to serve HTTPS in front of it:
- SiloOS has its own Caddy and needs nothing in front. Read on only if a proxy of yours must sit above the machine.
- A container needs a proxy of yours, or a Caddy that Silo configures itself (Domains and HTTPS).
What a proxy must do
Section titled “What a proxy must do”Whatever proxy you use, the console works only when it:
- Keeps the
Hostheader. The content domain is served by subdomain (tunnel-…,app-…,share-…), and the desktop’s and console’s sockets check the origin against it. - Passes WebSockets. The desktop (
/vnc), the Bot’s terminal (/console) and calls (/voice/call) are WebSockets. - Does not buffer, and does not time out a long response. A conversation’s live updates are one long streamed response. A proxy that buffers it shows a reply only when it is finished; one that cuts it after a minute makes the console reconnect over and over.
- Accepts 50 MB uploads. That is the largest file a person can attach to a message.
- Adds
X-Forwarded-For, and is named in Admin → Settings → Sign-in → Trusted proxies. Until it is, every visitor looks like the proxy: they share one sign-in limit, so a few wrong passwords from anyone make everyone wait.
And Silo must know the address people use: Admin → Settings → Server → Public URL set to https:// your name.
Configuration
Section titled “Configuration”The proxy sits on the same host and forwards to 127.0.0.1:8080. Serve both names: the console’s and the content domain’s wildcard.
Then name the proxy in Trusted proxies, as the address the control plane sees it at. Sign in through the proxy and open Account → Sessions: the address shown there is the one to enter. It is usually 127.0.0.1, but a rootless Podman forwarding the port can show another, such as the container network’s gateway.
Caddy keeps the host, passes WebSockets and streams by itself. A wildcard certificate needs a DNS challenge, so the content domain gets a certificate per name instead, made on demand, and Caddy asks Silo before each one so nobody can make it request certificates for names at will:
{ on_demand_tls { ask http://127.0.0.1:8080/caddy/ask }}
silo.example.com { reverse_proxy 127.0.0.1:8080 { flush_interval -1 }}
*.silo-content.example.com { tls { on_demand } reverse_proxy 127.0.0.1:8080 { flush_interval -1 }}/caddy/ask answers only a caller on loopback or one of the trusted proxies, and only yes for names that exist.
map $http_upgrade $connection_upgrade { default upgrade; '' close;}
server { listen 443 ssl; http2 on; server_name silo.example.com *.silo-content.example.com;
# One certificate for both names: the content domain needs a wildcard. ssl_certificate /etc/ssl/silo/fullchain.pem; ssl_certificate_key /etc/ssl/silo/privkey.pem;
client_max_body_size 64m;
location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_buffering off; proxy_request_buffering off; proxy_read_timeout 1d; proxy_send_timeout 1d; }}
server { listen 80; server_name silo.example.com *.silo-content.example.com; return 301 https://$host$request_uri;}Keep 8080 and 8081 from the outside (Network): the proxy is the way in.
SiloOS serves HTTPS itself, on 443, with its own certificate authority. Your proxy ends TLS with its own certificate and opens a new connection to the machine:
- In SiloOS, Admin → Settings → HTTPS → Certificates: Silo’s own certificate authority (
caddy.mode: internal), since Let’s Encrypt would not reach the machine. - Download Root certificate from the same page and have the proxy trust it.
- Forward to
https://<machine>, keeping theHostheader and sending the same name as SNI, with everything from What a proxy must do.
Caddy keeps the Host header and passes WebSockets by itself.
silo.example.com { reverse_proxy https://10.0.0.20 { flush_interval -1 transport http { tls_server_name silo.example.com tls_trust_pool file /etc/caddy/siloos-root.crt } }}
# Tunnels and apps: a wildcard certificate needs your DNS provider's module.*.silo-content.example.com { tls { dns cloudflare {env.CF_API_TOKEN} } reverse_proxy https://10.0.0.20 { flush_interval -1 transport http { tls_server_name {http.request.host} tls_trust_pool file /etc/caddy/siloos-root.crt } }}proxy_pass https://10.0.0.20;proxy_ssl_server_name on;proxy_ssl_name $host;proxy_ssl_trusted_certificate /etc/ssl/silo/siloos-root.crt;proxy_ssl_verify on;proxy_set_header Host $host;# …and the WebSocket, buffering and timeout lines of the container example.Mail (25) and calls (3479, UDP and TCP) do not go through an HTTP proxy: forward those ports to the machine as they are.
Check it
Section titled “Check it”- Open the console, send a Bot a message, and watch the reply appear as it is written. If it appears only when finished, the proxy is buffering.
- Open the Bot’s Desktop. If it never connects, WebSockets are not passed, or the
Hostheader is not kept. - Account → Sessions lists each sign-in with its address. It should be yours, not the proxy’s.
Not covered
Section titled “Not covered”- SiloOS behind a proxy sees every visitor as the proxy. SiloOS’s Caddy does not take an
X-Forwarded-Forit did not set, so the control plane sees the proxy’s address, and everyone shares one sign-in limit. - A proxy that serves Silo under a path (
example.com/silo/). Silo needs a name of its own.