Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsTo send a node-fetch request through a proxy, create a proxy-capable Node.js HTTP agent and pass it in the request’s agent option. Setting HTTP_PROXY or HTTPS_PROXY alone does not make node-fetch use a proxy. The exact agent package and import syntax depend on your installed package versions and proxy setup.
How do I use a proxy with node-fetch?
The basic arrangement has two parts: a proxy URL that your application can read, and an agent that knows how to connect through that proxy. Pass the agent explicitly to fetch. The node-fetch 3.x README documents an agent option that accepts an Agent instance or a function returning an Agent.
The following CommonJS-shaped example illustrates the integration point for package versions that support these imports and constructor. The current https-proxy-agent API was not confirmed here, so check that package’s documentation and your installed version before treating the constructor line as copy-paste-ready:
const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');
const agent = new HttpsProxyAgent(process.env.HTTPS_PROXY);
async function main() {
const response = await fetch('https://example.com', { agent });
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
console.log(await response.text());
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Set HTTPS_PROXY in the process environment to a proxy URL supported by the agent package. Keep any credentials in deployment secrets or local environment configuration, not in checked-in source files. The example’s response.ok check handles HTTP error statuses; network, proxy, and connection failures reject the request and are handled by the catch block.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- 【WIRELESS MOBILE MINI TRAVEL ROUTER】 Convert a public network (wired or wireless) to a private Wi-Fi for secure surfing. Tethering. Powered by any laptop USB, power banks or 5V/2A DC adapters (sold separately). 39g (1.41 Oz) only, portable and pocket friendly. 2.4GHz ONLY
- 【OPEN SOURCE & PROGRAMMABLE】 OpenWrt pre-installed, USB disk extendable.
- 【LARGER STORAGE & EXTENDABILITY】 128MB RAM, 16MB Flash ROM, dual Ethernet ports, UART and GPIOs available for hardware DIY.
- 【OPENVPN CLIENT】 OpenVPN client pre-installed, compatible with 30+ VPN service providers.
- 【PACKAGE CONTENTS】 GL-MT300N-V2 (Mango) mini router (2-year Warranty), USB cable, Ethernet cable, User Manual. Please update to the latest firmware.
Check your node-fetch major version first
The node-fetch project README referenced here is for version 3.x. Its module format differs from older CommonJS-based usage: if your project uses node-fetch 3.x, use ESM imports or the project’s supported compatibility approach rather than assuming require('node-fetch') works. If your project is on an older major version, verify that version’s API and the selected agent package’s compatibility before copying an example.
Do not mix package versions or import forms by guesswork. Check the installed versions in your project’s dependency manifest and lockfile, then consult the corresponding package documentation for the constructor and module syntax.
Why is node-fetch ignoring HTTP_PROXY?
Because node-fetch does not automatically read HTTP_PROXY or HTTPS_PROXY and apply them to requests. Microsoft Learn describes this limitation for node-fetch. An environment variable is only configuration data; it has an effect when the HTTP client, runtime agent, or wrapper you chose explicitly reads and uses it.
For node-fetch, the documented integration point is the request’s agent option. Construct a compatible agent using your proxy configuration and pass it to the request. If you want environment-driven behavior without constructing an agent yourself, choose a client or wrapper whose own documentation explicitly supports that configuration, and verify its maintenance and compatibility.
Rank #2
- 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
- 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
- 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
- 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
- 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.
Choose an approach that matches your Node.js stack
| Approach | Proxy interface | What to verify |
|---|---|---|
| node-fetch | agent option; an Agent instance or a function returning one |
Installed node-fetch major version, module syntax, selected agent package API, and destination/proxy protocol support |
| Node.js built-in agent proxy support | Node HTTP agent configuration, including environment proxy support in recent Node.js releases | Node.js version and whether the feature is available and enabled in that runtime; it does not automatically configure every node-fetch version |
| Undici | ProxyAgent supplied through a dispatcher |
Use Undici’s dispatcher interface, not node-fetch’s agent option |
| Third-party environment-variable wrapper | Wrapper-specific configuration | Current maintenance, version compatibility, and documented behavior; one registry listing for node-fetch-with-proxy reports version 0.1.6 published five years ago |
Node.js v26.10.0’s HTTP documentation describes configuring the global agent with NODE_USE_ENV_PROXY=1 or --use-env-proxy, as well as custom proxyEnv settings and NO_PROXY patterns. The documentation marks built-in proxy support as active development. This is a runtime-specific capability, not a substitute for checking how your particular node-fetch version obtains its agent.
Undici’s documented API is different: it uses a ProxyAgent as a dispatcher. Native Node fetch, Undici fetch, and node-fetch are related but are not interchangeable for proxy configuration. Do not pass a dispatcher where node-fetch expects an agent or assume an agent option configures Undici.
Use the right agent for the destination and proxy
Choose an agent package that supports both the destination protocol and the proxy protocol in your environment. An HTTPS destination through an HTTPS proxy, for example, is a configuration to check against the selected package’s documentation rather than infer from the word “proxy” in its name. Also confirm how the agent handles authentication and whether your proxy permits the requested destination.
A redirect can change the destination from HTTP to HTTPS or vice versa. The node-fetch README permits an agent function, which can select an agent based on the request URL. If your redirect chain can cross protocols, confirm how the selected package handles that chain and whether you need a URL-sensitive agent choice.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #3
- One Place for All Your Data - Consolidate scattered files from multiple computers, phones and external drives into one accessible hub with 100% ownership
- Professional File Collaboration - Share projects with clients, sync documents across teams and maintain version control without Dropbox fees
- Automated Backup Protection - Set-and-forget backups for Macs, PCs and mobile devices to multiple destinations including cloud and external drives
- DIY Surveillance System - Transform IP cameras into a professional monitoring solution with motion alerts, recording schedules and remote viewing
- 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates
For an existing company or hosting proxy, use the endpoint and access rules provided by its administrator. A separately purchased proxy service is not required by node-fetch itself; this is a client-configuration question, not a requirement to buy a proxy product.
Keep proxy configuration out of source code
- Read secrets from the environment: configure a proxy URL through your deployment platform’s secret store or local environment. Avoid committing usernames, passwords, or private proxy endpoints.
- Do not print credentials: error logging should identify the failure and status without dumping a full proxy URL that may contain authentication information.
- Set bypass rules intentionally: if you use runtime proxy support with
NO_PROXY, check the documented pattern behavior and the exact hosts that should bypass the proxy. - Limit access: follow your organization’s rules for which destinations the proxy may reach and which requests are permitted.
Common errors and how to troubleshoot them
The request still connects directly
Check that the request actually receives the constructed agent in its options. Verify that the environment variable exists in the same process that runs Node.js and that the code reads the correct variable name. Merely setting HTTP_PROXY or HTTPS_PROXY does not configure node-fetch.
The agent import or constructor fails
The installed agent package may use a different export, module format, or API than the example. Check its documentation for the installed version and adjust the import and constructor accordingly. Also confirm your node-fetch major version and whether the project uses CommonJS or ESM.
The proxy rejects the connection
Confirm the proxy URL is present and correctly formed for the selected agent, that credentials are valid, and that the proxy permits the destination and protocol. A failure can originate from the proxy or its access policy rather than node-fetch; inspect the error without exposing secrets.
Rank #4
- Unlimited bandwidth, unlimited data.
- Super-fast VPN and one tap connect.
- Free worldwide multiple servers.
- Works with all type of data carries. (Wi-Fi, 4G, LTE, 3G).
- No registration, sign up needed.
Some requests work but redirected requests fail
Inspect whether the redirect changes destination protocol or host. Confirm the agent package’s behavior for redirects and, if necessary, use node-fetch’s agent-function form to choose an agent based on the destination URL.
NO_PROXY or runtime proxy settings appear ineffective
First establish which layer is expected to read those settings. Node.js’s built-in proxy configuration applies to supported Node agents in the documented runtime context; it should not be assumed to change every node-fetch setup. Verify the Node.js version, how the global agent is enabled, and the documented bypass pattern syntax.
An Undici example does not work with node-fetch
Undici configures proxying through a dispatcher and ProxyAgent; node-fetch uses an agent option. Follow the API for the client actually making the request rather than combining examples from different fetch implementations.
Performance, reliability, and cost considerations
A proxy adds an additional network hop and another service whose availability and policy can affect the request. The actual latency, throughput, reliability, and cost depend on the proxy and network conditions; the available documentation cited here does not establish universal performance figures. If this is production traffic, monitor request failures and latency at your application, and check the proxy operator’s own limits and service terms.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Best Value
- Complete Phone & Computer Backup - Automatically protect photos, documents and videos from iPhone android, Mac and Windows to one secure location
- Your Private File Cloud - Access files from anywhere and share large projects with family or clients without relying on expensive cloud subscriptions
- Smart Home Security Hub - Monitor your home 24/7 with AI-powered surveillance that detects people, vehicles and sends instant alerts
- 100% Data Ownership - Keep full control of your personal data with multi-platform access and no monthly subscription fees
- 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates
For reliability, distinguish an HTTP response from a connection failure: an HTTP status such as 403 or 502 is still a received response, while DNS, connection, TLS, or proxy negotiation errors may reject the request. Apply retries only when appropriate for the operation and error, and avoid blindly retrying requests that can cause duplicate side effects.
Environment support, bypass rules, authentication, and destination permissions are separate concerns. A working agent does not guarantee that a proxy allows every host, and a configured bypass list can intentionally send some traffic outside the proxy.
Or skip the browser setup
If your actual goal is to capture a website screenshot or PDF rather than make an application fetch request, ScreenshotNeo is a separate website screenshot API and MCP server from Yorker Media; it is not a proxy setting for node-fetch. Its API takes one GET request for a URL and returns a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo site and the API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Does node-fetch support an HTTP proxy without an agent?
No. Pass a proxy-capable Agent through node-fetch’s agent option, or use a separately documented runtime or wrapper configuration.
Can I use an Undici ProxyAgent with node-fetch?
Undici uses a dispatcher interface; node-fetch uses agent. Use the proxy API belonging to the client making the request.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




