Other proxies

Traefik, Nginx Proxy Manager, Caddy in Docker, Apache, and others.

Use this page when a proxy runs on the server already and it is not Caddy or nginx under systemd. Examples: Traefik, Nginx Proxy Manager, Caddy in Docker, Apache, HAProxy.

Automatic

sudo bash install.sh zerodot.example.com --proxy none

--no-proxy is the same. The script changes no proxy. At the end, it prints:

  • The upstream address, for example http://127.0.0.1:3000.
  • The settings that the proxy needs.
  • An example Caddy block.
  • For a proxy in Docker, the network to connect.

When another program has ports 80 and 443, none is the default.

What to send

Mode Upstream
Docker mode All paths to http://127.0.0.1:3000 (the port in docker-compose.override.yml).
Native mode All paths to http://127.0.0.1:<web port>. Or the API paths to the API port, and the rest to the web port.

The API paths are /api/v1/*, /api/auth/*, /api/p/*, /hooks/*, /hooks-test/*, /resume/*, /mcp, /mcp/* and /oauth2/*. In native mode, the web app sends these paths to the API app itself. Thus one upstream works. A split is faster.

Settings that the proxy needs

  • Keep the Host header.
  • Set X-Forwarded-For and X-Forwarded-Proto.
  • Turn off response buffering. Live event streams (server-sent events) must arrive at once.
  • Let reads take a long time: 1 hour.
  • Let uploads up to 100 MB in.
  • Serve HTTPS. Sign-in cookies need it.

A proxy in Docker

The app listens on 127.0.0.1 of the server. A container cannot reach this address: 127.0.0.1 in a container is the container.

Docker mode

Connect the proxy container to the network of the install. Then use the name proxy.

  1. Find the name of the network. It is <project>_default. The project is the name of the install folder, for example zerodot:

    cd /var/www/zerodot
    docker compose config | sed -n 's/^name: //p'
    
  2. Connect the proxy container:

    docker network connect zerodot_default <proxy container>
    
  3. In the proxy, set the upstream to http://proxy:3000.

docker network connect does not survive a new container. If you make the proxy container again, connect it again. Or add the network to the compose file of the proxy:

services:
  traefik:
    networks: [default, zerodot]
networks:
  zerodot:
    name: zerodot_default
    external: true

Native mode

A proxy in Docker cannot reach 127.0.0.1 on the server. Use one of these:

  • A proxy on the server (Caddy or nginx).
  • A Cloudflare Tunnel (--proxy cloudflared).

Examples

Traefik (file provider)

http:
  routers:
    zerodot:
      rule: Host(`zerodot.example.com`)
      entryPoints: [websecure]
      service: zerodot
      tls:
        certResolver: letsencrypt
  services:
    zerodot:
      loadBalancer:
        servers:
          - url: http://proxy:3000

Traefik does not buffer responses by default. Live event streams work.

Nginx Proxy Manager

  1. Connect the Nginx Proxy Manager container to zerodot_default (see above).

  2. Add a Proxy Host:

    • Domain Names: zerodot.example.com
    • Scheme: http
    • Forward Hostname / IP: proxy
    • Forward Port: 3000
  3. In the SSL tab, request a new certificate. Turn on Force SSL.

  4. In the Advanced tab, add:

    proxy_buffering off;
    proxy_read_timeout 1h;
    client_max_body_size 100m;
    

Caddy in Docker

Connect the Caddy container to zerodot_default. Then add this block:

zerodot.example.com {
	encode gzip
	reverse_proxy proxy:3000 {
		flush_interval -1
	}
}

Apache

Turn on the modules:

sudo a2enmod proxy proxy_http headers ssl

Add this to the virtual host for port 443:

ServerName zerodot.example.com
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
ProxyTimeout 3600
ProxyPass / http://127.0.0.1:3000/ flushpackets=on
ProxyPassReverse / http://127.0.0.1:3000/

flushpackets=on sends each part of a live event stream at once.

Change this page on GitHub