web代理服务器(工具推荐)

关于ReproxyReproxy是一个简单且功能强大的边缘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或docker pull ghcr.io/umputun/reproxy提供程序我们可以通过各种提供程序来给工具提供代理规则,当前支持文件、Docker和静态规则三种形式。每一个提供程序都可以为代理请求和静态(资产)定义多个路由规则,用户可以同时设置多个提供程序。静态规则这是最简单的提供程序,可以直接在命令行工具中定义所有需要映射的规则,而且还支持定义多个规则。其中,每个规则需要用3或4个逗号对元素进行分隔,元素包含服务器、源URL、目的地址和[ping-url]:*,^/api/(.*),https://api.example.com/$1

example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping文件规则reproxy –file.enabled –file.name=config.yml下面给出的是config.yml文件样例:default: # the same as * (catch-all) server

  – { route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/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.2:8080/blah2/$1/abc" }这种属于动态提供程序,所有的文件修改都可以自动部署。Docker规则Docker提供程序支持完全的自动化发现,而且无需额外配置,支持修改的标签包含:reproxy.server

reproxy.route

reproxy.dest

reproxy.port

reproxy.ping

reproxy.enabled工具使用SSL支持SSL模式(默认)可以设置为auto、static或none。如果设置为auto,则会自动为所有发现的服务器发布SSL证书,用户可以通过设置–ssl.fqdn值来修改配置。Ping和健康检测Reproxy针对该功能提供了两个节点:/ping:查看Reproxy的开启和运行情况;

/health:返回200 OK状态码,检查服务器健康状况;管理API这是一个可选项,能够使用“–mgmt.enabled”开启,此时会在mgmt.listen上暴露两个节点:GET /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 hanshake 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

本文出自快速备案,转载时请注明出处及相应链接。

本文永久链接: https://www.175ku.com/26912.html