Why use a reverse proxy
- TLS encryption — all traffic between clients and your server is encrypted with HTTPS
- Custom domain — access Comis at
comis.yourdomain.cominstead of an IP address and port number - Hide the port — users visit a standard HTTPS URL without needing to know the port (4766)
- Security headers — the proxy can add headers that protect against common web attacks
Comis configuration
Before setting up the proxy, configure the Comis gateway to accept proxied connections. In yourconfig.yaml:
- host: “127.0.0.1” — the gateway only listens on localhost (the reverse proxy handles external connections)
- trustedProxies — tells Comis to trust the
X-Forwarded-Forheader from the proxy, so rate limiting and logging show the real client IP instead of the proxy’s IP
Nginx
Create the configuration
Create a new Nginx config file for Comis:Paste the following configuration:Replace
comis.yourdomain.com with your actual domain name.Here is what the important lines do:| Directive | What it does |
|---|---|
proxy_pass | Forwards all requests to the Comis gateway on port 4766 |
X-Real-IP | Passes the client’s real IP address to Comis |
X-Forwarded-For | Standard header for tracking the original client through proxies |
X-Forwarded-Proto | Tells Comis whether the original request was HTTP or HTTPS |
Upgrade + Connection | Enables WebSocket connections (used by the web dashboard and API) |
proxy_read_timeout 86400 | Keeps WebSocket connections alive for up to 24 hours |
Enable the site
Create a symlink to enable the config, test it, and reload Nginx:Expected output from
nginx -t:Caddy
Caddy is a simpler alternative that handles TLS automatically with zero extra configuration.Install Caddy
Create the Caddyfile
Edit the Caddyfile (usually at Replace
/etc/caddy/Caddyfile):comis.yourdomain.com with your actual domain name.That is the entire configuration. Caddy automatically:- Obtains a TLS certificate from Let’s Encrypt
- Redirects HTTP to HTTPS
- Renews certificates before they expire
- Handles WebSocket connections
CORS configuration
If you access the web dashboard from a different domain than the API (uncommon), you may need to configure CORS. In yourconfig.yaml:
Verifying the setup
After setting up the reverse proxy and TLS, verify everything is working: 1. Check the health endpoint:https://comis.yourdomain.com in your browser. You should see the Comis
web dashboard.
Related pages
Web UI
Set up and access the web dashboard.
Docker
Run Comis in a Docker container.
systemd
Run Comis as a systemd service.
pm2
Run Comis with the pm2 process manager.
Daemon
How the daemon starts, runs, and shuts down.
