Use this file to discover all available pages before exploring further.
Codex-LB includes a built-in firewall system that restricts API access based on client IP addresses. When enabled, only requests from allowed IPs can access the proxy endpoints (/v1/* and /backend-api/codex/*).
Trust X-Forwarded-For headers for client IP detection.
Only enable this when Codex-LB is behind a trusted reverse proxy (nginx, Caddy, Cloudflare, etc.).If enabled without a trusted proxy, clients can spoof their IP by setting the X-Forwarded-For header, completely bypassing the firewall.
When to enable:
Codex-LB is behind nginx/Caddy/HAProxy/Traefik
Codex-LB is behind Cloudflare or another CDN
You need to see real client IPs in logs and firewall checks
Comma-separated list of CIDR ranges for trusted proxy sources.Only requests from these IPs will have their X-Forwarded-For headers trusted. This prevents malicious clients from spoofing IPs.Examples:
def get_client_ip(request): socket_ip = request.client.host # Only trust X-Forwarded-For if socket IP is in trusted proxy list if socket_ip in TRUSTED_PROXY_CIDRS: xff_chain = request.headers.get("X-Forwarded-For").split(",") # Walk chain backwards, stop at first untrusted proxy for ip in reversed(xff_chain): if ip not in TRUSTED_PROXY_CIDRS: return ip return socket_ip
This prevents IP spoofing by only trusting X-Forwarded-For when the direct connection comes from a trusted proxy.
# Find your public IPcurl https://ifconfig.me# Output: 203.0.113.42# Add to allowlistcurl -X POST http://localhost:2455/api/firewall/ips \ -d '{"ipAddress": "203.0.113.42"}'
Now only requests from 203.0.113.42 can access the API.
Allow My Office Network
# Add the entire subnetcurl -X POST http://localhost:2455/api/firewall/ips \ -d '{"ipAddress": "192.168.1.1"}'curl -X POST http://localhost:2455/api/firewall/ips \ -d '{"ipAddress": "192.168.1.2"}'# ... repeat for each IP, or add a CIDR range in future versions
Allow Localhost Only
curl -X POST http://localhost:2455/api/firewall/ips \ -d '{"ipAddress": "127.0.0.1"}'curl -X POST http://localhost:2455/api/firewall/ips \ -d '{"ipAddress": "::1"}'
This restricts API access to local processes only.
Temporarily Disable Firewall
# Remove all IPs from allowlistcurl -X DELETE http://localhost:2455/api/firewall/ips/203.0.113.42curl -X DELETE http://localhost:2455/api/firewall/ips/198.51.100.0# Firewall automatically switches to "allow_all" mode