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 Name | Data Type | Required | Description |
---|---|---|---|
UPSTREAM_NAME | string | Yes | The unique identifier name for the upstream service |
ssl | string | Yes | Indicates whether the upstream service uses HTTPS; set to true for HTTPS, otherwise false |
disable_ssl_verify | bool | Yes | Whether to disable SSL certificate verification; for upstream services with self-signed certificates, set to true to disable verification |
servers | array | No | List of upstream servers, one or more server instances can be configured |
host | string | Yes | The hostname or IP address of the upstream server |
port | integer | Yes | The 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.