Sitelet https://hardhat.org/docs/cookbook/http-proxies
Skip to content

Using Hardhat 3 with a HTTP proxy

Hardhat sends its requests through a proxy when one is configured in the environment. This applies to things like JSON-RPC requests, mainnet forking, downloading compilers and verifying contracts.

Set https_proxy for HTTPS requests and http_proxy for HTTP ones. The uppercase HTTPS_PROXY and HTTP_PROXY work too:

Terminal window
export HTTPS_PROXY=http://proxy.example.com:8080

Use NO_PROXY or no_proxy to reach some hosts directly. It takes a list of entries separated by commas or spaces:

Terminal window
export NO_PROXY=example.com,.internal.dev,staging.example.com:8080

Each entry also covers its subdomains, so example.com excludes api.example.com as well. You can write an entry as .example.com or *.example.com if you prefer. Adding a port restricts the entry to that port.

Set NO_PROXY to * to turn proxying off entirely.

Requests to localhost and other loopback addresses are never proxied, so a local node stays reachable without any extra configuration.