关于Reproxy
Reproxy是一个简单、强大的边缘http(s )服务器和反向代理工具,支持各种提供程序,包括Docker和文件。 这些提供程序向工具提供有关请求服务器的基本信息、URL地址、目标URL和运行状况检查URL等数据,并可以作为单个二进制文件或Docker容器分发。
通过
功能介绍
let’s encrypt退出自动化SSL; 支持用户提供的SSL证书,但简单灵活的代理规则; 静态命令行代理规则提供程序; 基于文件的动态代理规则提供程序支持具有自动发现功能的Docker提供程序多个(虚拟)主机; 可选流量压缩; 用户定义的限制和发布超时二进制文件; Docker容器发行; 内置静态资产服务器; 具有路由信息管理服务器;
工具安装
源码安装
广大研究者可以访问该项目的Releases页面,选择和检索相应版本的Reproxy。
Docker安装
Reproxy的Docker容器版本可在Docker Hub上找到。 请执行以下命令:
docker pull umputun/reproxy或
可以通过当前支持三种格式: dockerpullghcr.io/umputun/re proxy
提供程序
文件、docker和静态规则的各种提供程序为工具提供代理规则。 每个提供程序都可以为代理请求和静态(资产)定义多个路由规则,用户可以同时设置多个提供程序。
静态规则
这是最简单的提供程序,可以直接定义需要在命令行工具中映射的所有规则,还支持定义多个规则。 其中,每个规则必须用三个或四个逗号分隔包含服务器、源URL、目标地址和[ping-url]的元素。
、^/API/()、https://api.example.com/$1
example.com,/foo/bar,https://api.example.com/zzz,https://API.example.com/ping
文件规则
re proxy-file.en ampple
默认: # the same as * (catch-all )服务器
-{route:’^/API/SVC1/(.* )、dest : ‘ http://127.0.0.133608080/blah1/$1) }
– {
route: ‘/api/svc3/xyz ‘,
dest : ‘ http://127.0.0.3:8080/blah3/XYZ ‘,
‘ ping ‘ : ‘ http://127.0.0.3:8080/ping ‘,
}
srv.example.com:
-{route:’^/API/SVC2/(.* ) },dest : ‘ http://127.0.0.233608080/blah2/$1/ABC ‘ }属于此类动态提供程序
Docker规则
Docker提供程序支持完全自动发现,不需要其他配置。 支持更改的标签如下:
reproxy.server
reproxy.route
reproxy.dest
reproxy.port
reproxy.ping
re proxy.enabled
工具使用
SSL支持
SSL模式(默认值)可以设置为自动、静态或无。 设置为auto后,将自动为所有发现的服务器颁发SSL证书。 用户可以通过设置–ssl.fqdn值来更改配置。
Ping和健康检测
Reproxy为此功能提供了两个节点:
/ping :确认re proxy的启动和执行情况;
/health :返回200 ok状态代码,检查服务器健康状况;
管理API
这是可选的,可以在–mgmt.enabled中打开。 在这种情况下,mgmt.listen会暴露两个节点。
葛
T /routes:枚举所有发现的路由
GET /metrics:返回Prometheus metrics;
所有可用的应用程序选项
-l, –listen= listen on host:port (default: 127.0.0.1:8080) [$LISTEN]
-m, –max= max request size (default: 64000) [$MAX_SIZE]
-g, –gzip enable gz compression [$GZIP]
-x, –header= proxy headers [$HEADER]
–signature enable reproxy signature headers [$SIGNATURE]
–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 test (default: 80) [$SSL_HTTP_PORT]
–ssl.fqdn= FQDN(s) for ACME certificates [$SSL_ACME_FQDN]
assets:
-a, –assets.location= assets location [$ASSETS_LOCATION]
–assets.root= assets web root (default: /) [$ASSETS_ROOT]
–assets.cache= cache duration for assets (default: 0s) [$ASSETS_CACHE]
logger:
–logger.stdout enable stdout logging [$LOGGER_STDOUT]
–logger.enabled enable access and error rotated logs [$LOGGER_ENABLED]
–logger.file= location of access log (default: access.log) [$LOGGER_FILE]
–logger.max-size= maximum size in megabytes before it gets rotated (default: 100) [$LOGGER_MAX_SIZE]
–logger.max-backups= maximum number of old log files to retain (default: 10) [$LOGGER_MAX_BACKUPS]
docker:
–docker.enabled enable docker provider [$DOCKER_ENABLED]
–docker.host= docker host (default: unix:///var/run/docker.sock) [$DOCKER_HOST]
–docker.network= docker network [$DOCKER_NETWORK]
–docker.exclude= excluded containers [$DOCKER_EXCLUDE]
–docker.auto enable automatic routing (without labels) [$DOCKER_AUTO]
file:
–file.enabled enable file provider [$FILE_ENABLED]
–file.name= file name (default: reproxy.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]
timeout:
–timeout.read-header= read header server timeout (default: 5s) [$TIMEOUT_READ_HEADER]
–timeout.write= write server timeout (default: 30s) [$TIMEOUT_WRITE]
–timeout.idle= idle server timeout (default: 30s) [$TIMEOUT_IDLE]
–timeout.dial= dial transport timeout (default: 30s) [$TIMEOUT_DIAL]
–timeout.keep-alive= keep-alive transport timeout (default: 30s) [$TIMEOUT_KEEP_ALIVE]
–timeout.resp-header= response header transport timeout (default: 5s) [$TIMEOUT_RESP_HEADER]
–timeout.idle-conn= idle connection transport timeout (default: 90s) [$TIMEOUT_IDLE_CONN]
–timeout.tls= TLS bmdpw transport timeout (default: 10s) [$TIMEOUT_TLS]
–timeout.continue= expect continue transport timeout (default: 1s) [$TIMEOUT_CONTINUE]
mgmt:
–mgmt.enabled enable management API [$MGMT_ENABLED]
–mgmt.listen= listen on host:port (default: 0.0.0.0:8081) [$MGMT_LISTEN]
Help Options:
-h, –help Show this help message
项目地址
Reproxy:https://github.com/umputun/reproxy