Skip to content

Working with Other Proxies

UA3F can run as a local processing node before or after other proxy tools. A common setup is to run UA3F in SOCKS5 or HTTP mode and let Clash, gateway firewall rules, or another proxy client forward selected TCP/HTTP traffic to UA3F.

Common topologies

Clash forwards to UA3F

This is the simplest setup for desktop Clash deployments. Clash handles rule routing and upstream proxies, while UA3F handles HTTP rewrite, MitM, L3 rewrite, or Desync.

text
Client -> Clash -> UA3F -> Direct/Upstream

UA3F configuration:

yaml
server-mode: SOCKS5
bind-address: 127.0.0.1
port: 1080

rewrite-mode: GLOBAL
user-agent: "FFF"

Clash snippet:

yaml
proxies:
  - name: "ua3f"
    type: socks5
    server: 127.0.0.1
    port: 1080
    url: http://connectivitycheck.platform.hicloud.com/generate_204
    udp: false

rules:
  - NETWORK,udp,DIRECT
  - MATCH,ua3f

UA3F handles transparent traffic first

When UA3F runs on a gateway, it can use TPROXY, REDIRECT, or NFQUEUE mode to capture traffic before applying rewrite and network-layer processing.

yaml
server-mode: TPROXY
bind-address: 0.0.0.0
port: 1080

rewrite-mode: GLOBAL
user-agent: "FFF"

This setup must be paired with system firewall rules that send target traffic into UA3F's listen port. Linux gateway deployments are usually the better fit when TCP-layer processing, L3 rewrite, or Desync is needed.

Clash guidance

ScenarioRecommended setupNotes
HTTP rewrite onlyClash -> UA3F SOCKS5Clash handles routing; UA3F handles Header/Body/URL rewrite
HTTPS Header/Body rewriteClash -> UA3F SOCKS5 + MitMEnable MitM only for hostnames that need rewriting
Transparent gateway captureUA3F TPROXY or REDIRECTRequires firewall forwarding rules
L3 rewrite or DesyncUA3F gateway modeNetwork-layer features fit Linux gateways better
Upstream proxy subscriptionsClash proxy-providerClash keeps subscriptions; UA3F acts as the local processing node

Reference configurations

These files live in the UA3F repository under configs/clash and can be downloaded and adjusted as needed.

VariantFileUA3F modeNotes
China onlyua3f-socks5-cn.yamlSOCKS5Ready to use
Proxy supportua3f-socks5-global.yamlSOCKS5Add your subscription URL under proxy-providers > Global-ISP > url
DPI evasion with proxy supportua3f-socks5-global-dpi.yamlSOCKS5Add your subscription URL under proxy-providers > Global-ISP > url
TProxy with proxy supportua3f-tproxy-cn-dpi.yamlTPROXY / REDIRECT / NFQUEUEAdd your subscription URL under proxy-providers > Global-ISP > url
TProxy DPI evasion with proxy supportua3f-tproxy-global-dpi.yamlTPROXY / REDIRECT / NFQUEUEAdd your subscription URL under proxy-providers > Global-ISP > url

Troubleshooting

  • Ensure the UA3F listen address and port match the server and port values in Clash.
  • If UA3F and Clash do not share the same network namespace, do not use 127.0.0.1; use a reachable address instead.
  • UDP usually does not go through UA3F's HTTP rewrite flow, so NETWORK,udp,DIRECT is often appropriate in Clash.
  • When MitM is enabled, clients must trust the UA3F CA and mitm.hostname must match the target hostname.
  • When L3 rewrite or Desync is enabled, verify kernel support, firewall rules, and permissions first.

Released under the GPL-3.0 license.