Examples
Forward Proxy
HTTP listener that doubles as an egress gateway for clients configured with HTTPS_PROXY: CONNECT tunnels reach only the destinations in allow_destinations
Switching projects opens that project’s default documentation release.
Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.
Category: Setup-dependent integration
Task: HTTP listener that doubles as an egress gateway for clients configured with HTTPS_PROXY: CONNECT tunnels reach only the destinations in allow_destinations
Prerequisites: The external service, credentials, or certificates referenced by this configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
# Forward Proxy (Egress Allowlist)
#
# HTTP listener that doubles as an egress gateway for clients configured
# with HTTPS_PROXY: CONNECT tunnels reach only the destinations in
# allow_destinations. The filter pipeline runs on each CONNECT before the
# destination check; tunneled bytes are opaque to body-inspecting filters.
# Any other host or port is answered with 403, and IP-literal destinations
# never match a host pattern.
#
# CONNECT does not require TLS. The allowlist checks the destination, not
# the payload: an admitted client can send plaintext or any other protocol
# through a tunnel, and listing port 443 does not enforce HTTPS.
#
# Client -- CONNECT api.example.com:443 --> Praxis :8080 --> api.example.com:443
#
# Requires the experimental `forward-proxy` cargo feature.
#
# Usage:
# cargo run -p praxis-proxy --features forward-proxy -- \
# -c examples/configs/security/forward-proxy.yaml
#
# Exercise:
# HTTPS_PROXY=http://127.0.0.1:8080 curl https://api.example.com/
# HTTPS_PROXY=http://127.0.0.1:8080 curl https://other.example.org/ # 403
listeners:
- name: egress
address: "127.0.0.1:8080"
filter_chains: [egress]
forward_proxy:
enabled: true
# Close a tunnel after 2 minutes without traffic in either direction.
idle_timeout_ms: 120000 # 2 minutes
# Tunnels do not observe graceful shutdown; cap their lifetime.
max_duration_secs: 3600 # 1 hour
allow_destinations:
# Exact host, one port.
- host: api.example.com
port: 443
# Exact host, any port.
- host: docs.example.com
# Any subdomain of internal.example.com (not the apex), HTTPS only.
- host: "*.internal.example.com"
port: 443
filter_chains:
- name: egress
filters:
- filter: request_id
# One record per CONNECT. Add metadata.tunnel.close_reason to its
# fields to see how each tunnel closed; a tunnel a peer broke off
# after its 200 is recorded whatever the sampling.
- filter: access_log