Skip to content

reverse proxy

github-actions[bot] edited this page Dec 1, 2026 · 2 revisions

🔀 Reverse proxy

← All documentation

A reverse proxy gives Rollcall a name such as https://rollcall.example.com, adds HTTPS, and is the safe way to reach it from the internet. This page has working setups for nginx, Nginx Proxy Manager, Apache, Caddy, Traefik and HAProxy, and notes for Cloudflare Tunnel.

The examples send requests to Rollcall at 127.0.0.1:8080, which fits a proxy on the same machine. When the proxy runs in the same Docker Compose project as Rollcall, use the service name instead, such as rollcall:8080. Replace rollcall.example.com with your own name.

📋 What Rollcall needs from the proxy

Each example below already does all of this.

Need Why
Set X-Forwarded-Proto: https Rollcall marks the sign-in cookie secure only when it sees this
No response buffering for /api/events Pages update themselves over this one long-lived request (live updates). Buffering holds the updates back. Rollcall sends X-Accel-Buffering: no, which nginx honors
Requests may stay open for at least a minute /api/events stays open. Rollcall sends a keep-alive every 15 seconds, so a proxy timeout of 60 seconds or more is enough
Set X-Forwarded-For (or X-Real-IP) Rollcall limits failed sign-ins and new accounts per address. Behind a proxy, every request comes from the proxy, so Rollcall uses the last address in X-Forwarded-For instead, which the proxy adds. It trusts that header only from this machine or the local network
Large uploads allowed Photos are up to 20 MB, G-code from the slicer script up to 256 MB, and a backup to restore can be several GB. Many proxies stop at 1 MB unless you raise it

Rollcall doesn't use WebSockets, so the proxy needs no WebSocket setting.

Because Rollcall trusts X-Forwarded-For from local addresses, someone on your network who connects to Rollcall directly, past the proxy, can choose the address their sign-ins count against. Publishing the port only to the proxy (below) closes that.

After setting up the proxy, set PUBLIC_URL to the new address (see configuration), so notifications link back to Rollcall. If the proxy runs on the same machine, set BIND_ADDR=127.0.0.1:8080 (or publish the port as 127.0.0.1:8080:8080 in Docker), so only the proxy can reach Rollcall.

The nginx, Apache, Caddy, Traefik and HAProxy setups here, with and without a sub-path, were tested against a running Rollcall (nginx 1.24, Apache 2.4.58, Caddy 2, Traefik 3, HAProxy 2.8): sign-in, live updates, and a 30 MB upload. Nginx Proxy Manager runs nginx with the same settings.

To serve Rollcall under a path such as https://example.com/rollcall/ instead of its own name, see a sub-path at the end.

🟩 nginx

server {
    listen 443 ssl;
    http2 on;
    server_name rollcall.example.com;

    ssl_certificate     /etc/letsencrypt/live/rollcall.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/rollcall.example.com/privkey.pem;

    # Backups to restore can be large; 0 means no limit.
    client_max_body_size 0;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 1h;
        proxy_request_buffering off;
    }
}

server {
    listen 80;
    server_name rollcall.example.com;
    return 301 https://$host$request_uri;
}

On nginx older than 1.25.1, write listen 443 ssl http2; and leave out http2 on;. Rollcall's X-Accel-Buffering: no header already turns buffering off for live updates.

🧭 Nginx Proxy Manager

  1. Choose Hosts › Proxy Hosts › Add Proxy Host.

  2. On Details:

    • Domain Names: rollcall.example.com
    • Scheme: http
    • Forward Hostname / IP: the address of the machine running Rollcall, or the container name (rollcall) when both are on the same Docker network
    • Forward Port: 8080
    • Websockets Support isn't needed. Leave Cache Assets off, so an update's new pages show at once.
  3. On SSL, pick or request a certificate, and turn on Force SSL and HTTP/2 Support.

  4. On Advanced, under Custom Nginx Configuration, paste:

    client_max_body_size 0;
    proxy_read_timeout 1h;
    proxy_request_buffering off;
  5. Choose Save.

Nginx Proxy Manager sets Host and X-Forwarded-Proto by itself.

🪶 Apache

Turn on the modules first. On Debian and Ubuntu:

sudo a2enmod proxy proxy_http headers ssl
sudo systemctl restart apache2

Then add a site, such as /etc/apache2/sites-available/rollcall.conf, and turn it on with sudo a2ensite rollcall:

<VirtualHost *:443>
    ServerName rollcall.example.com

    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/rollcall.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/rollcall.example.com/privkey.pem

    ProxyPreserveHost On
    RequestHeader set X-Forwarded-Proto "https"
    # Backups to restore can be large; 0 means no limit.
    LimitRequestBody 0

    # Live updates: send each event on at once, and don't compress them.
    SetEnvIf Request_URI "/api/events" no-gzip
    ProxyPass        /api/events http://127.0.0.1:8080/api/events flushpackets=on timeout=3600
    ProxyPassReverse /api/events http://127.0.0.1:8080/api/events

    ProxyPass        / http://127.0.0.1:8080/ timeout=3600
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

<VirtualHost *:80>
    ServerName rollcall.example.com
    Redirect permanent / https://rollcall.example.com/
</VirtualHost>

The /api/events lines must come before the / lines, because Apache uses the first ProxyPass that matches. On RHEL, Rocky and Oracle Linux, the modules are on already in the httpd and mod_ssl packages, and the site goes in /etc/httpd/conf.d/rollcall.conf.

🔒 Caddy

Caddy gets a certificate by itself, sets the forwarded headers, and sends live updates on at once, so this is the whole Caddyfile:

rollcall.example.com {
    reverse_proxy 127.0.0.1:8080
}

With Docker Compose, next to Rollcall:

services:
  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data

volumes:
  caddy_data:

Then use reverse_proxy rollcall:8080 in the Caddyfile.

🚦 Traefik

Add labels to the rollcall service in Rollcall's docker-compose.yml. This assumes Traefik already has an entry point called websecure on port 443 and a certificate resolver called letsencrypt; change the names to match yours:

services:
  rollcall:
    # ...the rest as in Installation, without "ports:"
    labels:
      - traefik.enable=true
      - traefik.http.routers.rollcall.rule=Host(`rollcall.example.com`)
      - traefik.http.routers.rollcall.entrypoints=websecure
      - traefik.http.routers.rollcall.tls.certresolver=letsencrypt
      - traefik.http.services.rollcall.loadbalancer.server.port=8080

Rollcall and Traefik must share a Docker network. Traefik sets the forwarded headers and sends live updates on at once by itself, and doesn't limit upload size unless you add a buffering middleware.

⚖️ HAProxy

defaults
    mode http
    timeout connect 5s
    timeout client  1h
    timeout server  1h

frontend https
    bind :80
    bind :443 ssl crt /etc/haproxy/certs/rollcall.example.com.pem
    http-request redirect scheme https code 301 unless { ssl_fc }
    http-request set-header X-Forwarded-Proto https if { ssl_fc }
    option forwardfor
    use_backend rollcall if { hdr(host) -i rollcall.example.com }

backend rollcall
    server rollcall 127.0.0.1:8080

The .pem file holds the certificate chain followed by its private key. HAProxy passes the Host header through and doesn't buffer live updates or limit upload size.

☁️ Cloudflare Tunnel

A tunnel needs no open ports. In the Cloudflare dashboard, under Networks › Tunnels, add a public hostname such as rollcall.example.com with the service http://rollcall:8080 (or http://localhost:8080 when cloudflared runs on the same machine as Rollcall). Cloudflare sets X-Forwarded-Proto and passes live updates through.

On Cloudflare's free and Pro plans, uploads through Cloudflare are limited to 100 MB, which can stop a large backup restore or G-code upload. Restore a large backup from the server instead (see backups).

🧭 A sub-path

To serve Rollcall at https://example.com/rollcall/, set BASE_PATH=/rollcall and have the proxy pass the whole path through, without removing /rollcall (see a sub-path). Keep the other settings from the examples above.

nginx:

location /rollcall/ {
    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_read_timeout 1h;
    proxy_request_buffering off;
}

Write proxy_pass without a path after the port, so nginx passes /rollcall/ on unchanged.

Nginx Proxy Manager: in the proxy host for example.com, add the block above under Advanced › Custom Nginx Configuration, with the container name or address in proxy_pass. A Custom location there replaces the path, so use the Advanced box instead.

Apache:

SetEnvIf Request_URI "/rollcall/api/events" no-gzip
ProxyPass        /rollcall/api/events http://127.0.0.1:8080/rollcall/api/events flushpackets=on timeout=3600
ProxyPassReverse /rollcall/api/events http://127.0.0.1:8080/rollcall/api/events
ProxyPass        /rollcall/ http://127.0.0.1:8080/rollcall/ timeout=3600
ProxyPassReverse /rollcall/ http://127.0.0.1:8080/rollcall/

Caddy: use handle, not handle_path, which removes the path:

example.com {
    handle /rollcall* {
        reverse_proxy 127.0.0.1:8080
    }
}

Traefik: change the rule, and don't add a StripPrefix middleware:

- traefik.http.routers.rollcall.rule=Host(`example.com`) && PathPrefix(`/rollcall`)

HAProxy:

use_backend rollcall if { hdr(host) -i example.com } { path_beg /rollcall }

🩺 If something doesn't work

  • Pages don't update by themselves: the proxy is buffering /api/events, or closing it too soon. See pages don't update by themselves.
  • A photo, G-code or backup upload fails with 413: raise the proxy's upload limit, as in the examples.
  • You're signed out at once, or every page asks you to sign in: the proxy sets X-Forwarded-Proto: https for a page opened over plain http://, so the browser drops the secure sign-in cookie. Open the https:// address, and redirect http:// to it as the examples do.
  • Links in notifications point at the wrong address: set PUBLIC_URL.

Clone this wiki locally