diff --git a/proxy/include/proxy/proxy_server.hpp b/proxy/include/proxy/proxy_server.hpp index 115b1b5595..adc50d306d 100644 --- a/proxy/include/proxy/proxy_server.hpp +++ b/proxy/include/proxy/proxy_server.hpp @@ -138,6 +138,9 @@ namespace proxy { // 是 http proxy,则由 url 指定的 protocol 决定是否使用 ssl. bool proxy_pass_use_ssl_{ false }; + // 指定通过 http pass 作为下级代理, 通常可以使用 cdn 来实现多层代理. + std::string http_pass_; + // 启用 proxy protocol (haproxy)协议. // 当前服务将会在连接到 proxy_pass_ 成功后,首先传递 proxy protocol 以 // 告之 proxy_pass_ 来源 IP/PORT 以及目标 IP/PORT. diff --git a/server/proxy_server/main.cpp b/server/proxy_server/main.cpp index 63107c13e5..342e7df892 100644 --- a/server/proxy_server/main.cpp +++ b/server/proxy_server/main.cpp @@ -38,6 +38,7 @@ std::string socks_passwd; std::vector auth_users; std::string proxy_pass; bool proxy_pass_ssl = false; +std::string http_pass; bool ssl_prefer_server_ciphers = false; std::string ssl_certificate_dir; @@ -98,6 +99,7 @@ start_proxy_server(net::io_context& ioc, server_ptr& server) opt.proxy_pass_ = proxy_pass; opt.proxy_pass_use_ssl_ = proxy_pass_ssl; + opt.http_pass_ = http_pass; opt.ssl_cert_path_ = ssl_certificate_dir; opt.ssl_ciphers_ = ssl_ciphers; @@ -219,6 +221,8 @@ int main(int argc, char** argv) ("proxy_pass", po::value(&proxy_pass)->default_value("")->value_name(""), "Specify next proxy pass (e.g: socks5://user:passwd@ip:port).") ("proxy_pass_ssl", po::value(&proxy_pass_ssl)->default_value(false, "false")->value_name(""), "Enable SSL for the next proxy pass.") + ("http_pass", po::value(&http_pass)->default_value("")->value_name(""), "Specify next http(s) pass (e.g: https://user:passwd@domain/path).") + ("ssl_certificate_dir", po::value(&ssl_certificate_dir)->value_name("path"), "Directory containing SSL certificates, auto-locates 'ssl_crt.pem/ssl_crt.pwd/ssl_key.pem/ssl_dh.pem'.") ("ssl_certificate", po::value(&ssl_certificate)->value_name("path"), "Path to SSL certificate file.")