Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion proxy/plugin/proxy_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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("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 \
Expand Down