Configuration / HTTP
Actions
Every location ends in exactly one response, static-file, or proxy action.
Fixed response
action = { type = "response", status = 200, body = "OK" }
Returns the configured HTTP status and text body without filesystem or upstream work. Use it for health checks, simple diagnostics, or temporary responses.
Static files
action = { type = "static", directory = "./public" }
The directory is resolved from the process working directory. Thwip serves GET and HEAD, removes the query before resolving the path, prevents traversal outside the configured root, and maps a directory URL such as /docs/ to docs/index.html.
Responses use MIME detection, ETag/If-None-Match, Cache-Control: public, max-age=3600, and one byte range. Large files are streamed using bounded 64 KiB chunks instead of being loaded in full.
There is no PHP runtime. index.php is not selected as an index and would only be returned as a static file when explicitly requested.
Proxy: direct endpoint
action = { type = "proxy", upstream = "http://127.0.0.1:9000" }
Use this shorthand for one stable destination. Current upstream transport is plaintext http://; upstream HTTPS is not implemented.
Proxy: named group
action = { type = "proxy", upstream_group = "api" }
Use a named root-level group when several routes share endpoints or when load-balancing settings should have one source of truth.
Proxy: route-local pool
[http.servers.locations.action]
type = "proxy"
policy = "round_robin"
upstreams = [
{ url = "http://127.0.0.1:9001" },
{ url = "http://127.0.0.1:9002", weight = 2 },
]
Use inline endpoints for a pool that belongs to one route. A proxy action must specify exactly one of upstream, upstream_group, or upstreams.
Request behavior
Proxying supports request bodies framed with Content-Length and rejects unsupported transfer encodings. Hop-by-hop headers are removed, the upstream host is set for the selected target, and connection-close behavior remains explicit.
HTTP feature matrix
| Feature | Current behavior |
|---|---|
| Protocol | Accepts HTTP/1.x requests and emits HTTP/1.1 responses. |
| Methods | Static actions support GET and HEAD; response actions return their configured response. |
| Request bodies | Content-Length framing is validated and proxy requests can be forwarded. |
| Transfer encoding | Unsupported transfer encodings, including chunked requests, are rejected. |
| Connection lifetime | Responses explicitly close the connection; keep-alive is not available yet. |
| TLS ingress | Optional TLS 1.2/1.3 termination is configured per server with an ssl block. SNI certificate selection is not available yet. |
| Unavailable | HTTP/2, HTTP/3, WebSocket upgrades, and HTTPS upstreams are not implemented. |
Home