# Troubleshoot DNS and TLS

Distinguish between gateway parsing, target parsing, CONNECT, certificate chain, SNI, and system time issues.

DNS decides whether the gateway or target can be found, and TLS decides whether the target can be securely authenticated. Both types of errors should be recorded in stages.

## DNS

- First, parse the proxy gateway host.
- SOCKS5 domain name targets use proxy-side parsing.
- Check enterprise secure DNS, container configuration, and caching.

## CONNECT

- The HTTPS target first gets a successful CONNECT response from the proxy.
- 407 Proxy authentication error, not target TLS error.

## TLS

- Confirm the system time, trust library, SNI, and target host name.
- Do not turn off certificate validation as a fix.

## Contrast

- Use known public HTTPS targets.
- Compare curl with the library.
- Only one configuration change after retest.
