Closed MiniSuperDev closed 1 year ago
If this is about Node.js, https://github.com/gajus/global-agent is usually the go to tool for this, unfortunately, it doesn't yet support: https://github.com/gajus/global-agent/issues/52
Proxy support is not something we plan to or can support built-in here.
From what I've found, the easiest way to use a proxy with Node.js fetch
(and hence ky
) is via undici's experimental EnvHttpProxyAgent, which will respect the HTTP_PROXY
, HTTPS_PROXY
, and NO_PROXY
environment variables.
npm install undici
import { EnvHttpProxyAgent } from 'undici'
import ky from 'ky'
const kyWithProxy = ky.extend({ dispatcher: new EnvHttpProxyAgent() })
This obviously won't work outside of Node.js, but it's still useful to know about.
Thanks