Skip to content
GatewayMarkdown

Gateway configuration

Every setting the gateway reads from its environment when it starts, with its default, the addresses it serves for health and logging, and what it logs and traces.

Available, with limitsAPI

The gateway is configured entirely by environment variables, read once when it starts. Five are required; every other one has a default that suits a gateway beside one API. To change a setting, restart the gateway with the new value.

The gateway’s image isn’t published yet: ask your Cvyūh contact for it. The settings below are the ones it reads today.

A gateway missing a required setting, with a refresh interval of 3 seconds or less, or with a value that doesn’t parse stops at once and says which one.

  • The gateway’s client active in the realm, with the public half of its key: see Run the gateway. That’s done by a realm administrator in a group holding RealmOwner, with the API.
  • Access to where the gateway runs, to set its environment and mount its key file.
VariableWhat it setsExample
ISSUERThe realm’s issuer. Every token must carry it as iss, and the gateway reads the realm’s keys, policies and revocations at its originhttps://foobar.cvyuh.com/oauth2
JWT_AUDIENCEYour API’s audience. Every token must name it in aud, and the gateway’s resource metadata is published under ithttps://api.example.com
CLIENT_IDThe gateway’s own client in the realm, usually floorfloor
CLIENT_KEYThe path of the gateway’s private key, a P-256 key in PEM. The client’s public key in the realm is its other half/etc/gateway/key.pem
POLICY_SETThe policy set the gateway enforcesdefault
VariableDefaultWhat it sets
LISTEN0.0.0.0:8080Where callers reach the gateway, on plain HTTP/1.1: the inline proxy and the ext_authz check. Put your TLS front end before it
BACKENDhttp://127.0.0.1:8801Your API’s own address, where allowed requests go. Requests are decided on this host and port. One per gateway
ADMIN_LISTEN127.0.0.1:8802Where health probes and log levels are served: see Health and logging
AM_URLThe issuer’s originWhere the realm is reached, when not at the issuer’s own address, such as through a private network. Every call still names the issuer’s host
CA_FILENoneA certificate bundle to trust beside the public authorities, when the realm’s certificate comes from a private one
VariableDefaultWhat it sets
JWKS_REFRESH300Seconds between fetches of the realm’s signing keys. A token signed with a key the gateway hasn’t seen makes it fetch them at once, at most once every 10 seconds
POLICY_REFRESH60Seconds between fetches of the policy set
BLACKLIST_REFRESH10The revocation poll interval: seconds between polls of the revocation feed. Three missed in a row and the gateway fails closed
TOKEN_REFRESH_MARGIN60Seconds before the gateway’s own token expires that it gets a new one

Each interval must be longer than 3 seconds, the most a single fetch may take. See How fast revocation takes effect for what a shorter revocation poll interval buys.

VariableDefaultWhat it sets
SCOPESNoneComma-separated scopes the resource metadata names as scopes_supported, for clients to ask for
DPOP_REQUIREDfalseRefuse every token not bound to a key: see Bound tokens at the gateway
DPOP_NONCE_KEYNoneThe path of a file of random bytes nonces are made with, such as one made by openssl rand 32 > nonce.key. Set, every proof must carry a nonce the gateway issued. Give every replica the same file
PUBLIC_ORIGINThe audience’s originThe scheme and host clients address the API at, when it isn’t the audience’s. A proof names the address the client used
MTLS_FROM_FACEfalseThe forwarded-certificate setting: read the client certificate your TLS front end forwards in x-forwarded-client-cert, for certificate-bound tokens. Set it only where every request comes through that front end
UPSTREAM_AUDIENCENoneYour API’s own resource identifier. Set, every allowed call goes on under a fresh token meant for it alone: see Token swap
VariableDefaultWhat it sets
MCP_PATHSNoneComma-separated paths an MCP server answers at, such as /mcp. A POST to one is decided as the MCP call it makes: see MCP tool calls
MCP_MIRRORED_DOORfalseThe headers-only setting: decide an ext_authz check that carries no body on its MCP headers alone. Set it only when your proxy has already held the headers to the body
VariableDefaultWhat it sets
APP_LOGinfoThe level the gateway’s own log starts at: off, error, warn, info, debug or trace. Change it while the gateway runs at /admin/log

Some variables carry names that will change, with the names above kept working beside the new ones:

TodayWill also be read as
AM_URLREALM_URL
BLACKLIST_REFRESHREVOCATIONS_REFRESH
MTLS_FROM_FACEMTLS_FORWARDED_CERT
MCP_MIRRORED_DOORMCP_HEADERS_ONLY
APP_LOGLOG_LEVEL

Until then, only the names in the tables above are read.

WhatDefaultCan it change?
Connecting to your API5 secondsNo
Your API’s answer60 seconds, then 504No
Retries of a failed call to your APINoneNo
Request bodies1 MiB on an MCP path; no limit elsewhereNo: cap sizes at your TLS front end
Any one fetch from the realm, or a decision asked of it3 secondsNo
Refresh intervalsLonger than 3 secondsAs above
APIs per gatewayOneNo

The gateway serves these on ADMIN_LISTEN, apart from the traffic it guards. Keep that address private.

MethodPathWhat it does
GET/health/liveAnswers 200 while the process runs
GET/health/readyAnswers 200 while it takes requests, and 503 once it’s stopping
GET/health/startupAnswers 200 once it has started
GET/health/backendsWhether the realm’s key set can be reached, as JSON
GET/admin/logThe log levels in force
PUT/admin/log?level=<level>Change the gateway’s log level while it runs: off, error, warn, info, debug or trace
PUT/admin/log/filterReplace the whole log filter, when Cvyūh support asks you to

On stop, the gateway finishes the requests in flight before it exits: see Run it in production.

The gateway writes its log to standard output, one JSON object per line. At the default level, each request writes:

  • One line as it arrives, with its method, its path and its trace id.
  • One line as it’s answered, with its status and how long it took, in milliseconds. A 5xx answer is logged as an error.
  • One warning line for each refusal, with the path, the caller (agent, the token’s sub) when the token verified, and why: the policy reason (such as policy_denied or no_matching_policy), a revoked token or agent, a proof that failed, or a missing or invalid token.

At debug, allows are logged too, with the caller and the path, and so is each decision the gateway asks the realm for, with its verdict.

Tracing. Each request continues the W3C trace context its caller sent in traceparent and baggage, or starts a new trace. The gateway passes it on to your API, and puts traceparent on its answer, so one trace id follows a call from the client through the gateway to your API. The trace id is on every line the request logs.

Your log collector keeps the gateway’s decisions: they aren’t on the realm’s audit trail yet. See What’s next for protecting APIs.

A gateway in front of an API at http://127.0.0.1:8801, for the realm foobar, with token swap and nonces on:

Terminal window
docker run -d --name gateway --network host \
-v "$PWD/gateway-key.pem:/etc/gateway/key.pem:ro" \
-v "$PWD/nonce.key:/etc/gateway/nonce.key:ro" \
-e ISSUER=https://foobar.cvyuh.com/oauth2 \
-e JWT_AUDIENCE=https://api.example.com \
-e CLIENT_ID=floor \
-e CLIENT_KEY=/etc/gateway/key.pem \
-e POLICY_SET=default \
-e BACKEND=http://127.0.0.1:8801 \
-e UPSTREAM_AUDIENCE=https://orders.internal.example.com \
-e DPOP_NONCE_KEY=/etc/gateway/nonce.key \
-e SCOPES=invoices:read,invoices:write \
"$GATEWAY_IMAGE"

$GATEWAY_IMAGE is the image your Cvyūh contact gave you.

SymptomCauseFix
The gateway exits at onceA required variable is missing, an interval is 3 seconds or less, or a value doesn’t parseIts last words name the variable and why
The gateway exits naming CA_FILE or DPOP_NONCE_KEYThe file can’t be read, or is emptyMount the file at the path you named
The gateway runs but refuses everythingIt can’t sign in to the realm or reach itSee Troubleshooting