From f54bd16618d3b9e3b2600f06905fe72514c5f009 Mon Sep 17 00:00:00 2001 From: Adnan Date: Tue, 25 Nov 2025 14:00:43 +0000 Subject: [PATCH 1/6] Add flag to forward all requests to proxy Added a flag '--forward-all' that sets the ProxyPool plugin to forward all requests to the remote proxy, including private requests. --- proxy/plugin/proxy_pool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/plugin/proxy_pool.py b/proxy/plugin/proxy_pool.py index c244adeda1..71e80e59ae 100644 --- a/proxy/plugin/proxy_pool.py +++ b/proxy/plugin/proxy_pool.py @@ -60,6 +60,11 @@ help='List of upstream proxies to use in the pool', ) +flags.add_argument( + '--forward-all', + action='store_true', + help='Forward all requests to the proxy, including private IP requests' +) class ProxyPoolPlugin(TcpUpstreamConnectionHandler, HttpProxyBasePlugin): """Proxy pool plugin simply acts as a proxy adapter for proxy.py itself. @@ -93,10 +98,12 @@ def before_upstream_connection( """ # We don't want to send private IP requests to remote proxies try: - if ipaddress.ip_address(text_(request.host)).is_private: + if ipaddress.ip_address(text_(request.host)).is_private and not self.flags.forward_all: return request except ValueError: pass + except Exception as e: + logger.error(f"Unexpected error happened before upstream connection: {e}") # If chosen proxy is the local instance, bypass upstream proxies assert self._endpoint.port and self._endpoint.hostname if self._endpoint.port == self.flags.port and \ From 86579e3b3b06b5ebb0432b0078bec463738c364b Mon Sep 17 00:00:00 2001 From: Adnan Date: Tue, 25 Nov 2025 14:17:05 +0000 Subject: [PATCH 2/6] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 190bfe0398..bb47f71883 100644 --- a/README.md +++ b/README.md @@ -2641,7 +2641,7 @@ usage: -m [-h] [--tunnel-hostname TUNNEL_HOSTNAME] [--tunnel-port TUNNEL_PORT] [--ca-file CA_FILE] [--ca-signing-key-file CA_SIGNING_KEY_FILE] [--auth-plugin AUTH_PLUGIN] [--cache-requests] [--cache-by-content-type] [--cache-dir CACHE_DIR] - [--proxy-pool PROXY_POOL] [--enable-web-server] + [--proxy-pool PROXY_POOL] [--forward-all] [--enable-web-server] [--enable-static-server] [--static-server-dir STATIC_SERVER_DIR] [--min-compression-length MIN_COMPRESSION_LENGTH] [--enable-reverse-proxy] [--rewrite-host-header] [--enable-metrics] @@ -2815,6 +2815,8 @@ options: storage. --proxy-pool PROXY_POOL List of upstream proxies to use in the pool + --forward-all Default: False. Forwards all requests to the + remote proxy. --enable-web-server Default: False. Whether to enable proxy.HttpWebServerPlugin. --enable-static-server From e8963fd82af419e25e05fdd4a3d5d82d1d77bbdb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:20:08 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- proxy/plugin/proxy_pool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/plugin/proxy_pool.py b/proxy/plugin/proxy_pool.py index 71e80e59ae..7e878883b2 100644 --- a/proxy/plugin/proxy_pool.py +++ b/proxy/plugin/proxy_pool.py @@ -61,9 +61,9 @@ ) flags.add_argument( - '--forward-all', + '--forward-all', action='store_true', - help='Forward all requests to the proxy, including private IP requests' + help='Forward all requests to the proxy, including private IP requests', ) class ProxyPoolPlugin(TcpUpstreamConnectionHandler, HttpProxyBasePlugin): From a7a5683f20236dedef757493ac6df37f0aed8e93 Mon Sep 17 00:00:00 2001 From: Adnan Date: Tue, 25 Nov 2025 14:23:57 +0000 Subject: [PATCH 4/6] Update proxy.py version in README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb47f71883..d602fe4ebe 100644 --- a/README.md +++ b/README.md @@ -2653,7 +2653,7 @@ usage: -m [-h] [--tunnel-hostname TUNNEL_HOSTNAME] [--tunnel-port TUNNEL_PORT] [--filtered-client-ips FILTERED_CLIENT_IPS] [--filtered-url-regex-config FILTERED_URL_REGEX_CONFIG] -proxy.py v2.4.8.dev8+gc703edac.d20241013 +proxy.py v0.1.dev946+gfec682b.d20251125 options: -h, --help show this help message and exit @@ -2867,3 +2867,4 @@ options: Proxy.py not working? Report at: https://github.com/abhinavsingh/proxy.py/issues/new ``` +` From d50f4568471302c0848532d9e45821190f1cc4e0 Mon Sep 17 00:00:00 2001 From: Adnan Date: Thu, 27 Nov 2025 14:35:05 +0000 Subject: [PATCH 5/6] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d602fe4ebe..3c37b737e3 100644 --- a/README.md +++ b/README.md @@ -2867,4 +2867,3 @@ options: Proxy.py not working? Report at: https://github.com/abhinavsingh/proxy.py/issues/new ``` -` From b310d65af8066ffa028579f24648e8f797359479 Mon Sep 17 00:00:00 2001 From: Adnan Date: Mon, 1 Dec 2025 16:05:43 +0000 Subject: [PATCH 6/6] Changed logger to lazy formatting --- proxy/plugin/proxy_pool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/plugin/proxy_pool.py b/proxy/plugin/proxy_pool.py index 7e878883b2..3bfea9ad58 100644 --- a/proxy/plugin/proxy_pool.py +++ b/proxy/plugin/proxy_pool.py @@ -103,7 +103,7 @@ def before_upstream_connection( except ValueError: pass except Exception as e: - logger.error(f"Unexpected error happened before upstream connection: {e}") + logger.error("Unexpected error happened before upstream connection: %s", e) # If chosen proxy is the local instance, bypass upstream proxies assert self._endpoint.port and self._endpoint.hostname if self._endpoint.port == self.flags.port and \