Skip to main content
Version: Canary ๐Ÿšง

Upstream

In APIPark, "upstream" refers to the backend servers or services to which API requests are ultimately routed. The upstream typically includes the actual business logic processing of API requests, data storage, and applications. In an API gateway architecture, the gateway receives and processes requests from the client, then forwards these requests to the upstream server for specific processing, retrieves the response, and returns it to the client.

Configuring upstream is a crucial step in the API open platform to ensure that API requests are routed correctly to the backend service. Upstream configuration involves defining and managing target addresses, load balancing strategies, and failover mechanisms to ensure high availability and performance of the service.

Operation Demonstrationโ€‹

Configure Upstreamโ€‹

  1. Select the service that needs configuration and enter the service's internal page.

  1. Click on Upstream to enter the upstream configuration page.

  1. Configure the upstream information, and after completing the configuration, click Save.

Field Description

Field NameDescription
Upstream TypeType of the upstream service; currently, only Static Upstream, which has fixed IP/domain name + port number service entrance is supported.
Service AddressThe access address of the upstream service; you can fill in multiple upstream addresses and configure the weight of each upstream service.
Request ProtocolThe protocol to request the upstream service, currently only supports HTTP/HTTPS.
Load BalancingThe load balancing algorithm, currently supports Weighted Round Robin and IP Hash.
Forward HostThe Host value used when requesting the upstream service; there are three options:

Transmit Client's Request Host:
Under this strategy, the gateway or proxy server will not modify the Host header information in the request. It will directly pass the client's (the party initiating the request) original Host header to the upstream service (the actual server providing the service).
This allows the upstream service to recognize the original domain of the request, thereby providing customized content or performing specific logic based on the original request's Host header.

Use the Upstream Service Host:

In this strategy, the gateway or proxy server replaces the original Host header in the request with one or more configured upstream service Host headers.
This is often used to route requests to a specific backend service, regardless of what the Host header in the client's request is. This can simplify the configuration of the upstream service, as they don't need to worry about the Host header information of incoming requests.

Rewrite Host:

This strategy involves modifying the Host header in the request, changing it to a specific value. This can be used in various situations, such as when there is a need to route requests to a different domain or when ensuring requests meet specific format or security requirements.
Rewriting the Host header can provide greater flexibility, but it may also lead to some unexpected behaviors, especially if the clients rely on the original Host header for certain operations.
Timeout DurationThe timeout duration for requesting upstream, in ms.
Timeout Retry CountThe number of retries allowed when a timeout occurs while requesting the upstream. If multiple service addresses are configured for the upstream, the gateway will re-request the unrequested service addresses.
Rate LimitationThe number of requests allowed per second for the current upstream.
Forward Upstream Request HeadersThe request header information that needs to be added or removed when requesting the upstream; if not configured, the gateway will forward the request headers to the upstream service as they are.

After filling in, click Save to complete.