Proxy URI Actions

OpenResty Edge provides the following actions to modify the proxy URI without changing the original client request URI.

Set proxy URI

this page rule sets the action “set proxy URI”, this action has only one parameter “URI”, you just need to enter the new proxy URI here, the new proxy URI needs to start with /.

This page rule also enables the proxy and sets the upstream to “httpbin.org”, the request will be forwarded to this upstream.

Example:

$ curl test.com/old
{
  ...
  "url": "http://test.com/anything"
}

You can see that the URI used to send the request is /old, while the URI forwarded upstream becomes /anything.

Rewrite proxy URI prefix

This action works by replacing the proxy URI prefix, it has two parameters “Prefix” and “Replacement”, the values of the parameters need to start with /.

Example:

$ curl test.com/prefix/b/c
{
  ...
  "url": "http://test.com/anything/b/c"
}

The URI sent upstream has changed from /prefix/b/c to /anything/b/c.