Skip to content

TLS and proxies ​

The server speaks plain HTTP on port 4000. Something in front of it terminates TLS: the Compose file's Caddy, your load balancer, or an ingress. This page is what that proxy has to do.

Drawing the diagram…

Everything comes in through one listener. The proxy must be the only way to reach port 4000.

What to configure ​

On the proxyWhy
Forward every path to port 4000The console (/ui/), the API and SDK gateway (/api/v1), /metrics and the health check share one listener.
Check GET /readyzIt is public, answers without a session or token, and is 503 until Redis, PostgreSQL and the migrations are ready.
Allow WebSocket upgradesThe console's live feed is a WebSocket at /api/v1/stream.
Allow requests of 10 seconds or longerSDK workers long-poll for up to 5 seconds.
Overwrite one header with the caller's addressSee below.
No sticky sessionsSessions are signed cookies; everything shared is in Redis and PostgreSQL.

The probes need no public exposure: the proxy may restrict /healthz and /readyz (and /metrics) to the internal network or the load balancer's own checks.

The bundled Caddyfile.selfhosted does all of it in ten lines and is a good model for another proxy.

The client address ​

Sign-in, sign-up and password reset are rate limited per caller. Behind a proxy every request comes from the proxy's address, so the server must be told which header carries the real one:

sh
JOOBQUI_CLIENT_IP_HEADER=X-Real-IP        # Caddy and nginx, when configured to set it
JOOBQUI_CLIENT_IP_HEADER=Fly-Client-IP    # Fly

It is also a setting on the console's Settings page, and it applies within seconds.

A header holding one address is that address. A list is believed only for X-Forwarded-For, where the caller is the entry JOOBQUI_TRUSTED_PROXIES places from the right (default 1: the proxy appends the address it saw); the first entry is whatever the caller wrote, so it is never used.

The proxy must overwrite the header

The server believes whatever the header says. If a caller can reach the server without passing the proxy, or the proxy passes on a header the caller sent, the caller chooses the address its rate limits count. Make the proxy the only way in, and make it replace the header on every request.

Without it a production server warns at start and counts every visitor as one client.

With no proxy at all, leave it unset (in the Compose file: JOOBQUI_CLIENT_IP_HEADER= in deploy/.env).

The public address ​

JOOBQUI_PUBLIC_URL is the https:// address people open. The setup page asks for it. Mailed links (password reset, email confirmation) and the single sign-on redirect are built from it, and it is the address the portal lists the server under.

What the server adds itself ​

Security headers on every answer (a content security policy, and HSTS in production), and the X-Requested-With check on state-changing requests made with a session cookie. The proxy needs to add neither.

Check it worked ​

sh
curl -fsS -o /dev/null -w '%{http_code}\n' https://jobs.example.com/readyz   # 200
curl -fsS https://jobs.example.com/api/v1/capabilities                                     # JSON, no sign-in

Then open the console's Overview page and enqueue a job: the numbers move without a reload when the WebSocket gets through the proxy.