Skip to content

litebastion: Out-of-spec status codes for some errors #62

Description

@niels-moller

From Gabriel Kihlman:

Request with unknown key-hash should return 421 but returns 502

"If the bastion maintains a full list of known backend keys, and the key hash is unknown, the bastion MUST serve a 421 "Misdirected request" response."

I started litebastion with a file of known backends, started up litewitness which connected to it, and I then asked for a unknown key hash:

$ curl -I -k https://localhost:9444/a933707e0e36c30f01d94b5d81e742da373679d88eb0f85f959ccd80b83b992a/
HTTP/2 502
date: Thu, 22 Jan 2026 10:11:14 GMT

Request for a known key-hash when litewitness is down should return 503 but returns 502

"If the key hash is known but there are no corresponding open backend connections, the bastion MUST serve a 503 "Service unavailable" response."

I started litebastion with a file of known backends, started up litewitness which connected to it. I did one connect to show it is up, killed litewitness and curled it again:

$ curl -I -k https://localhost:9444/e933707e0e36c30f01d94b5d81e742da373679d88eb0f85f959ccd80b83b992a/
HTTP/2 200
content-type: text/html; charset=utf-8
date: Thu, 22 Jan 2026 10:35:28 GMT
content-length: 722

[ killed litewitness which closed the backend connection:
  time=2026-01-22T11:37:34.839+01:00 level=INFO msg="backend connection closed" backend=e933707e0e36c30f01d94b5d81e742da373679d88eb0f85f959ccd80b83b992a remote=127.0.0.1:60136 ]

$ curl -I -k https://localhost:9444/e933707e0e36c30f01d94b5d81e742da373679d88eb0f85f959ccd80b83b992a/
HTTP/2 502
date: Thu, 22 Jan 2026 10:36:21 GMT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions