2024-10-02
Within a single request served by the “ingress”, i.e., whatever the DNS points to1, it may internally talk to a plethora of other dependent services internally, before the responses are “aggregated” back to the “user”. For all the chatter that happens in the course of this, there are “upstream” and “downstream” services, but which is which?
alt text, http request flow diagram. blocks: 1. "ingress/api.acmecorp.com" 2. gateway 3. microservice A 4. microservice B connections: 1. "ingress/api.acmecorp.com" towards gateway (arrow start, downstream; end, upstream) 2. gateway towards microservice A (arrow start, downstream; end, upstream) 3. microservice A towards microservice B (arrow start, downstream; end, upstream) boundaries: 1. surrounding gateway and microservice A, "north-south" 2. surrounding microservice A and microservice B, "east-west" arrows on either side. 1. left, top to bottom. text: "INBOUND request flow" 2. right, bottom to top. text: "OUTBOUND message/data/response flow"
A couple of definitions from RFC 9110, HTTP Semantics to aid our definitions, supported by these Stack Overflow answers 1 2.
RFC 9110, section 3.7. Intermediaries
The terms “upstream” and “downstream” are used to describe directional requirements in relation to the message flow: all messages flow from upstream to downstream. The terms “inbound” and “outbound” are used to describe directional requirements in relation to the request route: “inbound” means toward the origin server and “outbound” means toward the user agent.
RFC 9110, section 15.6.5. 504 Gateway Timeout
The 504 (Gateway Timeout) status code indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.
this is the simplest definition↩︎