
Lightweight edge HTTP(S) server and reverse proxy with automatic SSL, Docker/Consul discovery, per-route authentication, rate limiting, and health-check-based failover.
Reproxy is a simple edge HTTP(s) server / reverse proxy supporting various providers (docker, static, file, consul catalog). One or more providers supply information about the requested server, requested URL, destination URL, and health check URL. It is distributed as a single binary or as a docker container.
Server (host) can be set as FQDN, i.e. s.example.com, * (catch all) or a regex. Exact match takes priority, so if there are two rules with servers example.com and example\.(com|org), request to example.com/some/url will match the former. Requested url can be regex, for example ^/api/(.*) and destination url may have regex matched groups in, i.e. http://d.example.com:8080/$1. For the example above http://s.example.com/api/something?foo=bar will be proxied to http://d.example.com:8080/something?foo=bar.
Exact and *.example.com server names match the host case-insensitively and ignore one trailing dot, so Admin.Example.com and admin.example.com. hit an admin.example.com rule. Regex servers match as written, so add (?i) when case should not matter. Route regexes match the escaped request path, where a space is %20 and ü is %C3%BC, while static asset prefixes can be written as plain text. Route regexes are case-sensitive: when a protected route sits in front of an upstream that treats paths case-insensitively, add (?i) to that route.
For convenience, requests with the trailing / and without regex groups expanded to /(.*), and destinations in those cases expanded to /$1. I.e. /api/ -> http://127.0.0.1/service will be translated to ^/api/(.*) -> http://127.0.0.1/service/$1.
Before route matching, reproxy rejects with 400 a request whose decoded path contains a . or .. segment, repeated slashes (//), a ; or a backslash. A single trailing slash is allowed.
The host substitution is supported in the destination URL. For example, /files/${host} will be replaced with the matched host name. $host (without braces) can also be used.
Groups of a regex server can be used in the destination URL as ${host.1}, ${host.2} and so on (braces required). For example, server ^([^.]+)\.example\.com$ with route ^/(.*)$ and destination https://${host.1}.foo.com/$1 proxies http://aaaa.example.com/some to https://aaaa.foo.com/some. $1, $2 keep referring to the route groups. A missing group is replaced with an empty string, and so is any ${host.N} for an exact, * or *.example.com server, as those have no groups. Host values are inserted as is, without URL escaping, so keep server groups tight: anchor the regex with ^ and $, and capture only what a host label may hold, i.e. ([a-z0-9-]+) rather than (.*), which would also match .. from a host like ...example.com. Before route matching, reproxy rejects Host headers containing characters disallowed by HTTP host-header validation or containing %, returning 400. When a host token directly follows a route group, write the group with braces, i.e. ${1}${host.1}, as $1aaaa would be read as a group named 1aaaa.
Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates. Optional assets server can be used to serve static files. Starting reproxy requires at least one provider defined. The rest of parameters are strictly optional and have sane default.
Examples:
reproxy --static.enabled --static.rule="*,example.com/api/(.*),https://api.example.com/$1"reproxy --docker.enabled --docker.autodocker up -p 80:8080 umputun/reproxy --docker.enabled --docker.autodocker up -p 80:8080 -p 443:8443 umputun/reproxy --docker.enabled --docker.auto --ssl.type=auto --ssl.fqdn=example.comReproxy distributed as a small self-contained binary as well as a docker image. Both binary and image support multiple architectures and multiple operating systems, including linux_x86_64, linux_arm64, linux_arm, macos_x86_64, macos_arm64, windows_x86_64 and windows_arm. We also provide both arm64 and x86 deb and rpm packages.
brew install umputun/apps/reproxydocker pull umputun/reproxy or docker pull ghcr.io/umputun/reproxy.Latest stable version has :vX.Y.Z docker tag (with :latest alias) and the current master has :master tag.
Proxy rules supplied by various providers. Currently included - file, docker, static and consul-catalog. Each provider may define multiple routing rules for both proxied request and static (assets). User can sets multiple providers at the same time.
See examples of various providers in examples
This is the simplest provider defining all mapping rules directly in the command line (or environment). Multiple rules supported. Each rule is 3 to 7 comma-separated elements server,sourceurl,destination[,ping-url[,forward-health-checks[,timeout[,throttle]]]]. For example: