1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00
Simple edge server / reverse proxy http://reproxy.io/
Go to file
2021-04-09 15:16:06 -05:00
.github drop github format for linters 2021-04-09 15:16:06 -05:00
app lint: multiple warns cleanup 2021-04-09 15:05:22 -05:00
docs Create CNAME 2021-04-03 23:48:06 -05:00
scripts add binary distribution with goreleaser 2021-04-05 13:33:58 -05:00
vendor missing vendor 2021-04-05 22:14:23 -05:00
.gitignore add access log 2021-04-05 22:12:06 -05:00
.golangci.yml lint: multiple warns cleanup 2021-04-09 15:05:22 -05:00
.goreleaser.yml add binary distribution with goreleaser 2021-04-05 13:33:58 -05:00
Dockerfile fix container user 2021-04-08 22:06:44 -05:00
Dockerfile.artifacts add binary distribution with goreleaser 2021-04-05 13:33:58 -05:00
go.mod add access log 2021-04-05 22:12:06 -05:00
go.sum fix health error report 2021-04-08 22:07:15 -05:00
LICENSE Initial commit 2021-03-28 16:05:24 -05:00
Makefile add binary distribution with goreleaser 2021-04-05 13:33:58 -05:00
README.md more renaming leftovers 2021-04-03 19:24:22 -05:00
reproxy-example.yml add binary distribution with goreleaser 2021-04-05 13:33:58 -05:00
reproxy.service fix comments, more tests 2021-04-07 21:52:14 -05:00
SECURITY.md Create SECURITY.md 2021-04-07 00:02:46 -05:00

reproxy build

Simple edge reverse HTTP(s) proxy for various providers (docker, static, file). One or more providers supply information about requested server, requested url and destination url. Distributed as a single binary and a docker container.

Server can be FQDN, i.e. s.example.com or * (catch all). Requested url can be regex, for example ^/api/(.*) and destination url may have regex matched groups, 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.

Both HTTP and HTTPS supported for the server. 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 dpx requires at least one provider defined. The rest of parameters are strictly optional and have sane default.

example with a static provider: reproxy --static.enabled --rule="example.com/api/(.*),https://api.example.com/$1"

Providers

Static

This is the simplest provider defining all mapping rules directly in the command line (or environment). Multiple rules can be defined. Each rule is 2 or 3 comma-separated elements [server,]sourceurl,destination. For example:

  • ^/api/(.*),https://api.example.com/$1 - proxy all request to any host/server with /api prefix to https://api.example.com
  • example.com,/foo/bar,https://api.example.com/zzz - proxy all requests to example.com and with /foo/bar url to https://api.example.com/zzz

File

reproxy --file.enabled --file.name=config.yml

example of config.yml:

- {server: "*", route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/blah1/$1"}
- {server: "srv.example.com", route: "^/api/svc2/(.*)", dest: "http://127.0.0.2:8080/blah2/$1/abc"}
- {server: "*", route: "/api/svc3/xyz", dest: "http://127.0.0.3:8080/blah3/xyz"}

Docker

Application Options

  -l, --listen=                     listen on host:port (default: 127.0.0.1:8080) [$LISTEN]
  -t, --timeout=                    proxy timeout (default: 5s) [$TIMEOUT]
      --max=                        max response size (default: 64000) [$MAX_SIZE]
  -g, --gzip                        enable gz compression [$GZIP]
  -x, --header=                     proxy headers [$HEADER]
      --dbg                         debug mode [$DEBUG]

ssl:
      --ssl.type=[none|static|auto] ssl (auto) support (default: none) [$SSL_TYPE]
      --ssl.cert=                   path to cert.pem file [$SSL_CERT]
      --ssl.key=                    path to key.pem file [$SSL_KEY]
      --ssl.acme-location=          dir where certificates will be stored by autocert manager (default: ./var/acme) [$SSL_ACME_LOCATION]
      --ssl.acme-email=             admin email for certificate notifications [$SSL_ACME_EMAIL]
      --ssl.http-port=              http port for redirect to https and acme challenge [$SSL_HTTP_PORT]

assets:
  -a, --assets.location=            assets location [$ASSETS_LOCATION]
      --assets.root=                assets web root (default: /) [$ASSETS_ROOT]

docker:
      --docker.enabled              enable docker provider [$DOCKER_ENABLED]
      --docker.host=                docker host (default: unix:///var/run/docker.sock) [$DOCKER_HOST]
      --docker.network=             docker network (default: default) [$DOCKER_NETWORK]
      --docker.exclude=             excluded containers [$DOCKER_EXCLUDE]

file:
      --file.enabled                enable file provider [$FILE_ENABLED]
      --file.name=                  file name (default: dpx.yml) [$FILE_NAME]
      --file.interval=              file check interval (default: 3s) [$FILE_INTERVAL]
      --file.delay=                 file event delay (default: 500ms) [$FILE_DELAY]

static:
      --static.enabled              enable static provider [$STATIC_ENABLED]
      --static.rule=                routing rules [$STATIC_RULES]

Help Options:
  -h, --help                        Show this help message