Skip to main content

Request Headers

Authentication Headers

Agent-Key

Required for: All agent-facing proxy endpoints (POST /proxy, POST /proxy/execute/:actionId)
  • Format: Must start with agt_ prefix followed by alphanumeric string
  • Validation: Checked in middleware/auth.ts:74
  • Usage: SHA-256 hashed and matched against stored keyHash in the agents table
  • Security: Agent key is hashed using SHA-256 before database lookup to prevent plaintext storage
Agent keys starting with any prefix other than agt_ will be rejected with a 401 error.
Error responses:
  • Missing header: 401 - Missing Agent-Key header
  • Invalid format: 401 - Invalid Agent-Key format
  • Invalid key: 401 - Invalid Agent-Key
  • Revoked key: 401 - Agent key has been revoked

Authorization

Required for: Dashboard and user-facing endpoints (agents, services, etc.)
  • Format: Must use Bearer token authentication
  • Validation: Checked in middleware/auth.ts:31
  • Token Type: JWT access token issued by /auth/login or /auth/refresh
  • Expiration: Tokens expire after a configured duration (verify via JWT payload)
Error responses:
  • Missing header: 401 - Missing authorization header
  • Invalid format: 401 - Invalid authorization header format
  • Missing token: 401 - Missing token
  • Invalid/expired token: 401 - Invalid or expired token
The Authorization header is automatically stripped from requests before storing them in the approval queue to prevent credential leakage. See services/proxy.service.ts:409.

Idempotency Headers

Idempotency-Key

Required for: POST and PATCH requests to /proxy Optional for: GET, PUT, DELETE, HEAD, OPTIONS requests
  • Format: String, 1-255 characters
  • Scope: Per-agent (different agents can use the same key)
  • Behavior: See Idempotency for full details
  • TTL: Idempotency keys expire after 24 hours
  • Precedence: Header value takes precedence over idempotencyKey field in request body
Implementation: Extracted in routes/proxy.ts:48
POST and PATCH requests without an Idempotency-Key will be rejected with a 400 validation error.

Content Type Headers

Content-Type

Required for: All requests with a request body
  • Supported: application/json for GaiterGuard API endpoints
  • Proxy Requests: Any Content-Type supported by the target service (passed through)
  • Validation: JSON parsing errors return 400 with Invalid JSON in request body

Response Headers

Standard Headers

Content-Type

All responses include a Content-Type header:
For proxied requests, the Content-Type from the target service is passed through:

Proxy Metadata Headers

These headers are added by the GaiterGuard gateway to proxied responses.

X-Proxy-Status

Indicates how the request was processed:
Possible values:
  • forwarded - Request was forwarded to target service and response returned
  • executed-approved - Request was executed after human approval via /proxy/execute/:actionId
Implementation: Set in routes/proxy.ts:73 and routes/proxy.ts:218

X-Idempotency-Status

Indicates idempotency key usage (only present if idempotency key was provided):
Possible values:
  • processed - Request used an idempotency key (may be cache hit or new request)
The current implementation marks all idempotency-keyed requests as processed. Future versions may distinguish between hit (cached) and miss (new request).
Implementation: Set in routes/proxy.ts:81

Header Handling in Proxy Requests

Credential Injection

When forwarding requests to target services, GaiterGuard automatically injects authentication credentials based on the service’s authType: Implementation: See services/proxy.service.ts:212

Header Stripping for Security

When storing requests in the approval queue, sensitive headers are stripped:
Credentials are re-injected fresh from the encrypted vault when executing approved requests.

SSRF Prevention

GaiterGuard implements strict header and URL validation to prevent SSRF attacks:
  • Blocks requests to private IP ranges: 127.x, 10.x, 172.16-31.x, 192.168.x, 169.254.x
  • Blocks IPv6 loopback: ::1, fc00:, fe80:
  • Blocks localhost hostnames
  • Only allows http:// and https:// protocols
  • Validates target URL matches service baseUrl
Implementation: See services/proxy.service.ts:92

Header Examples

Agent Proxy Request

Dashboard Request

Proxied Response

Execute Approved Request