Configuring Gateway Settings

1. Setting Up Gateway Name and Description

FieldPurposeExample
nameUnique gateway identifierprod-edge-gw
descriptionHuman-readable summary"Public REST APIs"
tagsLabels for filtering[env:prod, team:platform]
ownerResponsible team/contactplatform@co.com

Example: Kong declarative config

_format_version: "3.0"
_transform: true
services:
  - name: orders-api
    url: https://orders.internal:8443
    tags: [env:prod, team:orders]
    connect_timeout: 5000
    read_timeout: 30000
    write_timeout: 30000

2. Configuring Base Path and Domain

SettingDescriptionExample
hostsDomain(s) the gateway servesapi.example.com
base_pathPrefix stripped from upstream/v1
strip_pathRemove match prefix before proxytrue
preserve_hostForward original Host headerfalse

3. Setting Default Protocol

ProtocolUseConfig
httpPlain dev/internallisten 80
httpsPublic TLSlisten 443 ssl
http2Multiplexed HTTPShttp2 on
http3QUIC over UDP NEWlisten 443 quic
grpcHTTP/2 + protobufgrpc_pass
ws/wssWebSocket upgradeproxy_http_version 1.1

4. Configuring Port Mappings

PortPurpose
80HTTP, typically redirect to 443
443HTTPS public traffic
8443HTTPS admin / internal
8001/8444Kong admin API (HTTP/HTTPS)
9090Metrics scrape (Prometheus)
15021Istio health/status

5. Setting Gateway Timeout Values

TimeoutDefaultDescription
connect_timeout5sTCP/TLS connect to upstream
read_timeout60sWait for upstream bytes
write_timeout60sSend body to upstream
idle_timeout75sKeep-alive idle close
request_timeout30sEnd-to-end ceiling
header_timeout10sReceive full headers

6. Configuring Request Size Limits

LimitDefaultNotes
client_max_body_size1MBReject > with 413
client_header_buffer_size1KBPer-header line
large_client_header_buffers4 8KBBig cookies/JWT
max_request_line8KBURL + method + version

7. Setting Connection Pool Settings

SettingDescriptionRecommended
max_connectionsUpstream cap per worker1024
max_pending_requestsQueue before reject100
max_requests_per_connectionRecycle threshold1000
max_retriesAuto-retry attempts3

8. Configuring Keep-Alive Settings

SettingPurposeValue
keepaliveIdle conns per upstream64
keepalive_timeoutClose after idle60s
keepalive_requestsReqs per connection1000
tcp_keepaliveOS-level probe30s

9. Setting Default Response Headers

Example: Default headers (NGINX)

add_header X-Gateway "edge-prod" always;
add_header X-Request-ID $request_id always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
more_clear_headers "Server" "X-Powered-By";
HeaderPurpose
X-Request-IDCorrelate logs across services
X-GatewayIdentify gateway instance
ServerRemove to hide implementation
Cache-ControlDefault caching policy

10. Configuring Buffer Sizes

BufferDefaultTuning
proxy_buffer_size4KBHeaders from upstream
proxy_buffers8 4KBBody buffering
proxy_busy_buffers_size8KBWhile sending to client
output_buffers2 32KBTo client socket
Warning: Disable buffering (proxy_buffering off) for SSE/streaming endpoints to avoid latency.