Fiery plugin for a single reverse proxy
Fiery plugin for a single reverse proxy
Details
This plugin establishes a reverse proxy between the server and a target origin server. It supports both HTTP and WebSocket connections and sets all the relevant headers for tracking the request along the proxy chain.
Initialization
A new 'ReverseProxy'-object is initialized using the new() method on
the generator:
Usage
route <- ReverseProxy$new(target, root = "/", continue = FALSE, trust = FALSE) |
Methods
Method new()
Create a new reverse proxy
Usage
ReverseProxy$new(target, root = "/", except = NULL, trust = FALSE)Arguments
targetThe URL to the origin server being proxied
rootThe root path the reverse proxy should respond to. Only requests to subsets of the root path will be proxied, and the root will be stripped from the URL path before being forwarded
exceptSubpaths to
rootthat should be excempt from forwarding to the target.trustAre requests coming from a trusted source
Examples
# Create a reverse proxy forwarding requests to http://example.com
rev_prox <- ReverseProxy$new(
"http://example.com"
)
# Use root to only proxy requests to a specific subpath
rev_prox <- ReverseProxy$new(
"http://example.com",
root = "forward"
)
# Use except to exempt certain subpaths from proxying
rev_prox <- ReverseProxy$new(
"http://example.com",
except = c("no_proxy", "dont/proxy")
)
## Attach it to a fiery app
if (requireNamespace("fiery", quietly = TRUE)) {
app <- fiery::Fire$new()
app$attach(rev_prox)
}