The API gateway that was an nginx config

Two services behind one hostname, with a routing table that somebody wanted to solve with a gateway product.

location /api/billing/ {
    proxy_pass http://billing:8080/;
    proxy_set_header X-Request-Id $request_id;
}

location /api/ {
    proxy_pass http://app:8080;
    proxy_set_header X-Request-Id $request_id;
}

# 14 lines. what a gateway would add: rate limiting we do
# in the application, auth we do in the application, and
# a control plane to operate.

A gateway earns its place when routing is dynamic, when there are enough services that a static file is unmanageable, or when cross-cutting concerns genuinely have nowhere else to live. With two services and a stable path prefix, none of those hold. The thing to keep from the gateway idea was the request id header, which is what makes a trace cross the boundary.