Upstream

To proxy requests to an upstream service, you need to define an upstream configuration in OpenResty Edge and refer to this configuration through directives such as set-upstream-name. Below is an example format for defining an upstream:

UPSTREAM_NAME:
  ssl: true/false
  disable_ssl_verify: true/false
  servers:
  - host: HOST
    port: PORT

Parameter Description

Parameter NameData TypeRequiredDescription
UPSTREAM_NAMEstringYesThe unique identifier name for the upstream service
sslstringYesIndicates whether the upstream service uses HTTPS; set to true for HTTPS, otherwise false
disable_ssl_verifyboolYesWhether to disable SSL certificate verification; for upstream services with self-signed certificates, set to true to disable verification
serversarrayNoList of upstream servers, one or more server instances can be configured
hoststringYesThe hostname or IP address of the upstream server
portintegerYesThe port number of the upstream server

Configuration Example

app_upstream_name1:
  ssl: false
  disable_ssl_verify: false
  servers:
  - host: 1.1.1.1
    port: 80
  - host: 1.1.1.2
    port: 80
app_upstream_name2:
  ssl: true
  disable_ssl_verify: false
  servers:
  - host: 1.1.1.3
    port: 443

The above example configuration defines two upstream services, app_upstream_name1 and app_upstream_name2. The first upstream includes two server instances, and the second upstream includes one server using HTTPS with SSL verification enabled.

In the upstream configuration file, the upstream services are organized in a key-value pair format, where the key is the upstream service name, and the value contains the relevant configuration details of the upstream.