Skip to content

Commit 7f9234f

Browse files
committed
docs(readme): document --use-x-forwarded-host and env var\n\nExplain when to enable, behavior (first value, comma-trimming, hostname-only, IPv6),\nand security considerations (trusted proxy).\n\nCo-authored-by: hugodutka <28019628+hugodutka@users.noreply.github.com>
1 parent bbf9102 commit 7f9234f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ agentapi server --allowed-hosts 'example.com,example.org' -- claude
102102
AGENTAPI_ALLOWED_HOSTS='example.com example.org' agentapi server -- claude
103103
```
104104

105+
If you're running behind a trusted reverse proxy that sets the `X-Forwarded-Host` header, you can opt in to using that header for host authorization with `--use-x-forwarded-host` (or `AGENTAPI_USE_X_FORWARDED_HOST=true`). When enabled, the server prefers the first `X-Forwarded-Host` value (trimming anything after a comma), extracts the hostname (ignoring any port, supports IPv6 bracket literals), and matches it against the allowed host list. Leave this disabled unless your deployment terminates at a trusted proxy.
106+
105107
#### Allowed origins
106108

107109
By default, the server allows CORS requests from `http://localhost:3284`, `http://localhost:3000`, and `http://localhost:3001`. If you'd like to change which origins can make cross-origin requests to AgentAPI, you can change this by using the `AGENTAPI_ALLOWED_ORIGINS` environment variable or the `--allowed-origins` flag.

0 commit comments

Comments
 (0)