Run the server

Put a proxy in front of Kraft

Serve the board behind a reverse proxy you run, or let a proxy on this machine pass webhooks and scripts to a loopback-bound Kraft, and check that nobody gets in without signing in.

Before you start

For the board:

  • A password. Set a password says how.
  • The name your browser types, such as kraft.example.com. It goes in allowed_hosts.
  • A firewall you control, to close Kraft's own port to every address but the proxy's.
  • A second device to check from.

For webhooks and scripts:

  • Kraft is bound to 127.0.0.1, which is the default.
  • A tunnel or reverse proxy on this machine: cloudflared, ngrok, Caddy or nginx.
  • A second device to check from. A request from this machine names a loopback client, and Kraft asks it for no password.

Choose the fix

A tunnel or reverse proxy on this machine that passes on the name its clients used gets a 403 for every request: unexpected Host for a server bound to 127.0.0.1. Scripts and webhooks get it too, and allowed_hosts isn't read. Who may call has the rule. Coming from 1.4, see Network access.

Choose the fix by what has to reach Kraft:

  • The board: serve it with a password and the name in allowed_hosts, as Serve the board behind a reverse proxy below says. For a way in with no proxy of your own, see Remote access. A loopback-bound Kraft behind a proxy serves webhooks and scripts only, never the board, because Kraft refuses the browser's sign-in and changes as cross-site.
  • Webhooks and scripts only: have the proxy send Host: localhost, as Send Host: localhost from the proxy says.

Serve the board behind a reverse proxy

Caddy, nginx or another proxy you run can serve the board at a name of your own while Kraft listens on a network bind behind it. Kraft listens on plain HTTP, so the proxy serves HTTPS. Off loopback, Kraft asks every client for the password or a token before any API call, a proxy on this machine included. /api/health, the page and its assets are open. Kraft also checks the Host and Origin the proxy passes on.

  1. Set a password with the commands in Set a password.
  2. In access.yaml, set bind off loopback and add the name your browser types to allowed_hosts:
    config/access.yaml
    bind: 0.0.0.0
    allowed_hosts:
      - kraft.example.com
    

    Bind 0.0.0.0, not 127.0.0.1, even when the proxy runs on this machine. On a loopback bind Kraft ignores allowed_hosts and answers only a loopback Host. Every request is refused unless the proxy sends Host: localhost, and then the board's sign-in and every change are refused as cross-site. That is why the webhook way serves webhooks and scripts only.
    Until the restart, change nothing on the Access screen: a change there rewrites access.yaml from what the running server holds and undoes this edit.
  3. Block port 8765 at your firewall for every address but the proxy's, before you restart. The wider bind listens on every network this machine is on, and a request that reaches the port directly meets only the password or a token, over plain HTTP.
  4. Set the proxy to pass what What the proxy must pass lists, with the setting your proxy uses for each.
  5. Restart Kraft so it binds the new address.
  6. Check it as Check it worked says, at the proxy's own name, including the two requests for this way.

Send Host: localhost from the proxy

  1. sender: another deviceHost: the name it used
  2. proxy on this machinesends Host: localhost and X-Forwarded-For: the sender
  3. Kraft finds the clientthe last X-Forwarded-For that isn't loopback
      1. remote, no password: 403 refusedno password set
      1. otherwise: Kraft checks the Host
          1. not localhost: 403unexpected Host
          1. localhost: is the client this machine?
              1. yes: header missing, or loopback passed through: no sign-in askedthe API is open
              1. no: a credentialsession, mcp-token bearer, or trigger token on POST /api/triggers
                  1. valid: API answers
                  1. none valid: 401no valid credential
The path of a request: the sender, then the proxy on this machine (Host localhost, X-Forwarded-For the sender), then Kraft. Kraft answers 403 to a remote client when no password is set, and 403 to a Host other than localhost. A client that is this machine gets no sign-in. Any other client gets 401 without a session, the mcp-token or the trigger token, and the API answers with one.

Before you rewrite Host, know what it does to sign-in. A loopback-bound Kraft asks a request from this machine for no password, and a request through a proxy on this machine is one, unless the proxy names its client in X-Forwarded-For. So:

  1. First set a password, as in Set a password.
  2. Make sure the proxy sets that header itself: nginx doesn't unless you add proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;, which appends the client's address. Appending or replacing is right. Never let the proxy pass a caller's own X-Forwarded-For through as it came: a caller who sends X-Forwarded-For: 127.0.0.1 would then be taken for a client on this machine, and Kraft would ask it for no login.
  3. Make the proxy send Host: localhost, with the setting for yours.
ProxySetting
cloudflaredhttpHostHeader: localhost in the ingress rule's originRequest, or --http-host-header localhost on the command line
ngrok--host-header=rewrite
Caddyheader_up Host localhost in the reverse_proxy block
nginxproxy_set_header Host localhost;

Kraft then asks every API call through the proxy for a session, for the mcp-token as a bearer, or, on POST /api/triggers, for the trigger token. /api/health, the page shell and its assets need none. While no password is set it refuses every request. Without X-Forwarded-For, everyone who reaches the proxy has the whole API, with no sign-in, password or not.

A proxy that is itself fed from loopback, such as an ssh -R endpoint or a second proxy on this machine, passes every request on as local, and Kraft asks it for no password even with one set. Put nothing like that in front of a loopback-bound Kraft.

Check it worked

Make the requests from another device, not from this machine: a request from this machine names a loopback client, and Kraft asks it for no password.

The board

  1. Request the health endpoint, which needs no login. Replace the address with the proxy's name:
    curl -s https://kraft.example.com/api/health
    

    A JSON status confirms the request reaches Kraft.
  2. Open the same address without /api/health in a browser. You should see the login page. Sign in with your password.
  3. On a computer, the sidebar reads live next to Kraft once the board's event connection is open, and the board updates without a reload.
  4. Request an API route with no credentials. Put your proxy's name in name:
    name=kraft.example.com
    curl -s -o /dev/null -w '%{http_code}\n' "https://$name/api/work-items"
    

    It must print 401. A 401 alone isn't proof of this setup: signing in at step 2 is.
  5. From a machine other than the proxy's, request the health endpoint at Kraft's own port. Set machine to this machine's address before you run it:
    machine=192.168.1.20
    curl -m 5 "http://$machine:8765/api/health"
    

    With the port blocked, this must fail: it times out, or is refused.

Webhooks and scripts

  1. /api/health answers with a JSON status.
  2. /api/work-items, with no credentials, answers 401. Then send it again with X-Forwarded-For: 127.0.0.1 added: it must still answer 401.

If it fails

Find what you saw, then do what it says.

A 403 that says unexpected Host

For webhooks, the proxy still sends the name its client used. Make it send Host: localhost, as Send Host: localhost from the proxy says. For the board, the same 403 means Kraft still binds 127.0.0.1: restart it so it reads bind: 0.0.0.0.

A 403 with no password set

Kraft refuses every request through the proxy until a password is set. Set one as step 1 of the way you follow says. For the board, a 403 also means Kraft still binds 127.0.0.1, so restart it.

A 200 where 401 is expected

For the board, Kraft took the request for a local one. It still binds 127.0.0.1, behind a proxy that sends Host: localhost. That is the webhook setup, not this one.

For webhooks, the proxy isn't sending X-Forwarded-For, so Kraft takes every request for a local one and everyone who reaches the proxy has the whole API. Fix that before you go on. Then send the request again with X-Forwarded-For: 127.0.0.1 added: it must still answer 401, and a 200 means the proxy passes a caller's own header through.

cross-site request refused or reconnecting…

The proxy rewrote Host to localhost or 127.0.0.1, changed Origin or doesn't pass the WebSocket. If the sidebar stays on reconnecting…, check that anything between the browser and Kraft passes WebSocket connections through and keeps the Host header the browser sent. The rows of What the proxy must pass say what each header does.

A 502 or another answer

The answer comes from the proxy itself, such as a 502 when it can't reach Kraft.

The health request at Kraft's own port answers

A JSON status means the port is still open to the sign-in over plain HTTP: block it at your firewall before you go on.

What the proxy must pass

For the board, set the proxy to pass what the table lists, with the setting your proxy uses for each. The first four rows are what the board needs. The last one keeps the sign-in lockout per client.

The proxy mustWhat Kraft does with itWithout it
Pass Host as the browser sent it, port included. Don't set it to localhost or to Kraft's own address.Checks the name against allowed_hosts for a browser request, and compares the Host with the Origin of every write and of the live-update socket.An unlisted name gets a 403 (the page names it). A Host rewritten to localhost or 127.0.0.1 (nginx's default) loads the page, but Kraft refuses the sign-in, every change and the socket as cross-site request refused.
Pass Origin through unchanged.Refuses a write (any request but GET or HEAD) or a socket whose Origin names another host and port than Host, unless it names this machine.An Origin the proxy changes gets the 403, cross-site request refused. One it drops turns the cross-site check off for writes.
Pass the WebSocket upgrade for /api/ws/events.Applies the same checks and the sign-in to the socket, and closes it when one fails.No live updates: the sidebar shows reconnecting… instead of live.
Send X-Forwarded-Proto: https when it serves HTTPS.Marks the session cookie Secure when the request is HTTPS or this header says https.The cookie isn't marked Secure.
Append the client's address to X-Forwarded-For. Don't pass a caller's own header through as sent.Takes the client from the last address in the header that isn't 127.0.0.1 or ::1, and counts failed logins per client.Every visitor counts as one address: 5 failed logins from anyone lock everyone out for 15 minutes. A header passed through as sent lets a caller pick its own address, so it is never locked out.

For the loopback-bound Kraft of the webhook way, leave FORWARDED_ALLOW_IPS unset. On a proxy on another machine, set FORWARDED_ALLOW_IPS in the server's environment to that proxy's address only, never *. Kraft reads X-Forwarded-For only from a peer at 127.0.0.1 or ::1 (uvicorn's default list), and a proxy on another machine connects from its own address, so without the setting Kraft takes every client for that proxy and the lockout is shared.

The hop from a proxy on another machine to Kraft is plain HTTP, so the password crosses that network in the clear.

A proxy that is itself fed from loopback passes every request on as local: see the warning under Send Host: localhost from the proxy.

Next steps

  • Remote access: reach the board over Tailscale, your local network or a tunnel
  • Who may call: the rule behind the 403
  • Inbound triggers: call POST /api/triggers from off-machine with the trigger token
  • Security: the threat model behind the password and the host check
Copyright © 2026