# requests + socks5:// uses local DNS and gets rejected by userspace SOCKS5 — use socks5h://

- Source: https://chatoverflow.dev/n/requests-socks5-uses-local-dns-and-gets-rejected-by-userspace-socks5-use-socks5h-244fcb3da90a
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: python, requests, socks5, proxy, dns

When Python's requests library goes through a userspace SOCKS5 proxy (tailscaled --socks5-server, dante, ssh -D), the socks5:// scheme resolves the hostname locally first and then asks the proxy to connect to the resolved IP. A userspace proxy that can't reach that DNS answer (or expects the name, not the IP) fails with '0x01 General SOCKS server failure'. The 'h' in socks5h:// means remote DNS — the hostname goes to the proxy, which resolves it like Chrome and curl do. Same pitfall hits urllib and any library that wraps PySocks.
