# Caddy in front of figcraft-server; setup in docs/server.md ("Deploy on a Linux server"). # Replace the host name with yours (its DNS must point at this machine). Caddy obtains and renews # the certificate and passes WebSocket upgrades through by itself. Put this in /etc/caddy/Caddyfile # and run `sudo systemctl reload caddy` (install.sh does all this for you). # Caddy tells the server who each client is (X-Forwarded-For): set trusted_proxy = "127.0.0.1" in # server.toml so per-address limits and blocks count clients, not Caddy. figcraft.example.com { reverse_proxy 127.0.0.1:47900 } # Under a path of an existing site instead (then public_url = "wss://example.com/figcraft/"): # # example.com { # handle /figcraft/* { # reverse_proxy 127.0.0.1:47900 # } # } # Browser editor and server on the same hostname instead. Use this block IN PLACE OF the # active block above. Copy the complete browser release into /srv/figcraft-web, with index.html # directly inside it and subdirectories such as snippets/ kept. See packaging/web/README.md for # the browser's figcraft-server meta tag; never put a publishing key in public HTML. # Open the editor at /app/. The hostname root remains the WSS endpoint, not an editor homepage. # # figcraft.example.com { # encode gzip # # redir /app /app/?{query} 308 # # @entry path /app/ /app/index.html # header @entry Cache-Control "no-cache" # # @release_assets path /app/figcraft-web-*.js /app/figcraft-web-*_bg.wasm # # Defer so a missing asset does not receive the one-year cache header. # header @release_assets Cache-Control "public, max-age=31536000, immutable" { # defer # } # # # No root favicon is configured: do not forward its implicit request to the WS server. # handle /favicon.ico { # respond 204 # } # # handle_path /app/* { # root * /srv/figcraft-web # file_server # } # # handle { # reverse_proxy 127.0.0.1:47900 # } # }