Basic terminology
Later sections will use a few terms you may not be familiar with, so let’s quickly cover them here.
Gateway
In today’s world, the gateway is usually an HTTP reverse proxy, a load balancer, and frequently a combination of both. This can be an HTTP server, such as nginx or Apache, a physical load balancer in the classical sense, or a cloud variant of this same idea. It can also be a content-delivery network (CDN). So, when you receive an HTTP status code mentioning an error related to the gateway, it’s one of these gateway devices or applications talking to you.
Upstream
The upstream is the service that an application proxies to. In most situations, this will be the actual application or service, for example, an HTTP service you wrote. It is good to keep in mind that one can cascade or layer proxies, so there might be another intermediate proxy between the first proxy and the actual web application. For example, in many cloud infrastructures...