Reverse proxy to upstream
Reverse proxy is a quite common function. Below is an introduction to how to configure the function in Edge Admin.
First, click to enter the Rewrite rules page, and add the rule reverse proxying the gateway to the upstream.
New Rule button first.
Enable the Proxy module in the rules which are disabled by default
Check the upstream first. If no
upstream has been added, the user can
choose to create an upstream
Each upstream needs a name, and the protocol it uses: HTTP or HTTPS,
active health checks can also be configured.
But the main part of an upstream is the upstream address, which can be:
Domain name (On the gateway node side, the resolver configured in the local /etc/resolv.conf of the node side will first be used to resolve the domain name, or the DNS resolver configured in the global configuration will be used)
Domain name of the Host field proxied to the backend (This address can be dynamic, which is associated with specific requests, and is normally not used)
An upstream can contain more than one backend nodes, with different weights assigned to different nodes. (The number of back-to-origin requests will be distributed according to the weight)
As mentioned, the same upstream can have more than one backend nodes. Besides that, more than one upstreams can be used simultaneously,
Weights can also be assigned to different upstreams, with the number of back-to-origin requests distributed according to the weight.
Along with the weights assigned within each upstream, the result is:
requests are first distributed according to the weights assigned among upstreams,
after being distributed to a specific upstream, the requests will be re-distributed based on the weights assigned to nodes of the upstream
For instance, a staging upstream can be added to distribute 10% requests to the staging upstream cluster.
As for conditions, different back-to-origin configurations may be chosen depending on the request information
The above API configuration relating to the v2 version, for instance, can follow:
Now, a simple proxy rule is successfully set.