Configure `httpxy` Proxy Server options
mainWhen using createProxyServer, you can pass an options object to control behavior.
| Option | Type | Default | Description |
|---|---|---|---|
target | string | URL | ProxyTargetDetailed | — | Target server URL |
forward | string | URL | — | Forward server URL (pipes request without the target's response) |
agent | http.Agent | false | keep-alive | Shared keep-alive agent. Set false to disable connection reuse |
ssl | https.ServerOptions | — | Object passed to https.createServer() |
ws | boolean | false | Enable WebSocket proxying |
xfwd | boolean | false | Add x-forwarded-* headers |
secure | boolean | — | Verify SSL certificates |
toProxy | boolean | false | Pass absolute URL as path (proxy-to-proxy) |
prependPath | boolean | true | Prepend the target's path to the proxy path |
ignorePath | boolean | false | Ignore the incoming request path |
localAddress | string | — | Local interface to bind for outgoing connections |
changeOrigin | boolean | false | Change the Host header to match the target URL |
preserveHeaderKeyCase | boolean | false | Keep original letter case of response header keys |
auth | string | — | Basic authentication ('user:password') for Authorization header |
hostRewrite | string | — | Rewrite the Location hostname on redirects (301/302/307/308) |
autoRewrite | boolean | false | Rewrite Location host/port on redirects based on the request |
protocolRewrite | string | — | Rewrite Location protocol on redirects ('http' or 'https') |
cookieDomainRewrite | false | string | object | false | Rewrite domain of Set-Cookie headers |
cookiePathRewrite | false | string | object | false | Rewrite path of Set-Cookie headers |
headers | object | — | Extra headers to add to target requests |
proxyTimeout | number | 120000 | Timeout (ms) for the proxy request to the target |
timeout | number | — | Timeout (ms) for the incoming request |
selfHandleResponse | boolean | false | Disable automatic response piping (handle proxyRes yourself) |
followRedirects | boolean | number | false | Follow HTTP redirects from target. true = max 5 hops; number = custom max |
buffer | stream.Stream | — | Stream to use as request body instead of the incoming request |