Skip to content

Behind a reverse proxy

Bullship serves plain HTTP on port 3200 and polls over plain HTTP, so it needs no WebSocket settings. Put it behind the proxy that terminates TLS and tell it two things:

BULLSHIP_URL=https://bullship.example.com
BULLSHIP_TRUSTED_PROXIES=127.0.0.1,10.0.0.0/8
  • BULLSHIP_URL is the address people open. An https URL makes session cookies Secure and adds HSTS; links in alerts and password reset emails point there.
  • BULLSHIP_TRUSTED_PROXIES lists the proxies whose X-Forwarded-For Bullship believes, so the sign-in rate limit counts each person and not the proxy. A made-up X-Forwarded-For from anyone else is ignored.

The proxy must pass Host and append to X-Forwarded-For. Without BULLSHIP_TRUSTED_PROXIES, the host the proxy passes must be BULLSHIP_URL’s or one in BULLSHIP_ALLOWED_HOSTS; any other host gets 421 (see Host names).

Caddy passes Host and appends to X-Forwarded-For on its own, so one line is enough:

bullship.example.com {
reverse_proxy localhost:3200
}
location / {
proxy_pass http://127.0.0.1:3200;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

If the proxy already signs people in (an identity-aware proxy, OAuth2 Proxy and the like), you can turn Bullship’s own sign-in off with BULLSHIP_AUTH=false. Everyone who reaches Bullship is then an admin, so make sure nothing reaches it except through the proxy. When the proxy’s session expires, the page reloads once so the proxy can sign the person in again.