Developer hub

Developer Proxy Examples

Use these guides when you need proxies in scripts, API clients, command-line tools, browser automation or test environments. The focus is practical setup: working formats, authentication, timeouts and verification.

Test outside the application first

Before adding a proxy to code, test it with a small independent tool. This separates proxy problems from application problems. If the proxy fails everywhere, fix the proxy format or credentials. If it works in the tester but fails in code, inspect environment variables, library support, SSL behavior and timeout settings.

Developers should also log the proxy ID, target host, HTTP status, elapsed time and error type. Without those fields, failed requests become impossible to diagnose after the fact.

Python Requests proxyConfigure HTTP and HTTPS proxies with timeouts and error handling.
cURL proxy examplesUse HTTP, HTTPS and SOCKS5 proxy flags from the command line.
GNU Wget proxy setupSet HTTP proxy variables, protect authentication and choose a SOCKS-aware alternative when required.
Node.js proxy guideSet proxies for fetch, Axios, Undici and environment variables.
PHP proxy examplesUse cURL proxy options and basic PHP connection checks.
Postman proxy setupConfigure and test proxies before API debugging.
Playwright proxiesUse proxies for browser automation and location-aware testing.
Selenium proxiesConfigure browser sessions for automated checks.
Puppeteer proxiesLaunch Chromium with proxy settings and authenticated flows.

More integration examples

How to Use a Proxy in n8n: HTTP Requests, Authentication and TroubleshootingConfigure an HTTP proxy in n8n, separate proxy and API authentication, import a test workflow, and troubleshoot Cloud and self-hosted requests.
HTTPX Proxy Guide: HTTP, SOCKS5 and Async Python ExamplesConfigure HTTPX proxies with encoded credentials, HTTP CONNECT, SOCKS5 support and bounded async requests. Includes Python examples and troubleshooting.
How to Configure Proxies in Docker and Docker ComposeSet Docker and Compose proxy settings at the right scope. Test container IPs, handle authentication, and distinguish builds from daemon image pulls.
Scrapy Proxy Setup: Authentication, Rotation and Error HandlingSet up Scrapy proxies with authentication, rotation middleware, bounded retries and certificate verification. Includes a downloadable spider and error guide.
Static Proxy IPs for API Allowlists: Setup and FailoverSet up static proxy egress for API IP allowlists. Verify exit addresses, preserve TLS and API tokens, and plan cutovers with a preapproved backup IP.
aiohttp Proxy Guide: Authentication and Concurrent RequestsConfigure aiohttp proxies with version-aware authentication, HTTP CONNECT, explicit timeouts and bounded concurrency. Includes a downloadable Python example.
How to Use an Authenticated Proxy in PowerShellUse an authenticated HTTP proxy with PowerShell web requests. Prompt safely for credentials, test the outbound IP, and diagnose common proxy errors.

Planning a production workload? Compare per-IP and per-GB costs before scaling.

Verified proxy compatibility: versions and test conditions

These results help you choose a client configuration to reproduce. We executed the named libraries and examples against local HTTP and SOCKS5 protocol fixtures that never forwarded traffic to the internet. They verify the listed local configurations, not routing through BuyProxies infrastructure or acceptance by your target website. Original five-client qualification: . The separately dated Node.js supplement below was qualified on .

“Verified” means the expected behavior was observed in the controlled test. “Not tested” means unknown in this qualification. On a narrow screen, focus the table area and scroll horizontally to read all columns. Dates below are UTC.

Real client versions tested with synthetic credentials and non-forwarding loopback fixtures
Client / version HTTP destination via HTTP proxy HTTPS destination via HTTP CONNECT SOCKS5 Verified proxy authentication Environment / test date Result / limits
Requests
2.34.2
Verified Verified Verified (socks5h) HTTP Basic; SOCKS username/password Python 3.12.14; Windows; PySocks 1.7.1; urllib3 2.8.0
16/16 expected results. get and Session. Separate guide-configuration reproduction; only socks5h tested.
HTTPX
0.28.1
Verified Verified Verified (socks5) HTTP Basic; SOCKS username/password Python 3.12.14; Windows; socksio 1.0.0
20/20 expected results. Sync and async; four-request batches. No compiled speedups.
aiohttp
3.14.5
Verified Verified Not tested HTTP Basic Python 3.12.14; Windows
7/7 expected results. Four-request batches; redirect classification and body-size limit checked. SOCKS unknown here.
Scrapy
2.19.0
Verified Verified Not tested HTTP Basic Python 3.12.14; Windows; Twisted 26.4.0
10/10 expected results. HTTP/1.1 handler; retries and robots.txt checked. Exit 0 alone is insufficient. SOCKS unknown here.
n8n
2.42.6
Verified Verified Not tested HTTP Basic Node 24.19.0; Windows; HTTP Request node 4.2
6/6 expected results. Server CLI and HTTP Request 4.2. Cloud, editor, Docker and SOCKS unknown here.

What the tests include

All five clients received the expected success response and rejected wrong proxy credentials and an untrusted TLS certificate. Destination 403 responses were distinguished from proxy-authentication failures. Requests, HTTPX, aiohttp and Scrapy also observed a first 302 response without following it. The aiohttp example reports that response as redirect_response; a redirect is not proof of a broken proxy. Scrapy checks included one bounded 503 retry, fixture pool selection and robots.txt exclusion. n8n preserved and exercised the workflow’s 30000 ms timeout.

Configuration and qualification limits

Certificate and hostname verification stayed enabled. Temporary fixture CAs were supplied only to the test processes; successful TLS requests did not disable verification. HTTPS through CONNECT means an HTTPS destination reached through a plain HTTP proxy. A TLS connection to the proxy itself was not tested. HTTPX and aiohttp used official pure-Python wheels imported as ZIPs; Scrapy used ZIP namespace loaders, pure-Python zope.interface and checked compression-extension aliases. These loading conditions are part of the qualification.

Requests used PySocks 1.7.1 with socks5h; a domain-name SOCKS request was observed, but external DNS resolution was not measured. HTTPX used socksio 1.0.0. SOCKS was not tested for aiohttp, Scrapy or n8n. IP allowlisting, remote exit IPs, speed, uptime, other client versions and your destination’s access policy were not qualified. Reproduce a small request from the actual deployment before relying on the configuration.

Official configuration references

  • Requests proxies: HTTP proxy URLs, proxy authentication and optional SOCKS support. The documented socks5 and socks5h schemes differ in where DNS is resolved.
  • HTTPX proxies: the proxy parameter, URL credentials and the optional SOCKS dependency.
  • aiohttp proxy support: HTTP proxies, CONNECT and authentication; version 3.14 deprecates proxy_auth in favor of explicit proxy headers.
  • Scrapy HttpProxyMiddleware: per-request proxy configuration and handler-dependent support. The tested HTTP/1.1 handler must not be treated as a qualification of the separate HttpxDownloadHandler.
  • n8n HTTP Request node: the explicit HTTP Proxy option and timeout setting. This local CLI result does not qualify n8n Cloud.

Download the original five-client compatibility matrix, 12 October 2026 (JSON) for the exact versions, example hashes, dates, controls and limitations. The file contains no proxy endpoints or credentials.

Node.js supplement: 14 October 2026

The following three request paths were executed on Windows with Node.js 24.17.0 against non-forwarding local HTTP/HTTPS services and an authenticated HTTP proxy fixture. They add 30 request controls and two separately labelled native-agent diagnostics. They do not extend the SOCKS or external-exit claims of the original five-client matrix.

Node.js request examples checked with synthetic credentials on 14 October 2026 UTC
Client / version HTTP via HTTP proxy HTTPS via CONNECT Proxy authentication Expected results NO_PROXY / limits
Built-in fetch
Node 24.17.0 / bundled Undici 7.28.0
Verified Verified HTTP Basic 12/12 Environment and flag opt-in; direct without opt-in. Exact-host bypass observed; IPv4 dash-range bypass not observed.
EnvHttpProxyAgent
Undici 7.30.0
Verified Verified HTTP Basic 10/10 Exact-host bypass observed; IPv4 dash-range bypass not observed. Dispatcher close retained.
Explicit proxy object
Axios 1.20.0
Verified Verified HTTP Basic 8/8 after correction The explicit proxy object still used the proxy for the NO_PROXY host. Error handling printed an integer HTTP status or a fixed literal, never the full error/config object.

Each request client was checked for HTTP and HTTPS success, wrong authentication, an untrusted target certificate, target 403, a same-fixture redirect and its unchanged 30-second timeout. TLS verification stayed enabled; the fixture CA was added to child-process trust alongside normal Node roots; the untrusted-certificate controls omitted it. Four original Axios error controls exposed synthetic authentication in process output; the corrected example passed all eight controls without it. Those original observations are retained.

The two distinct native-agent diagnostics observed IPv4 dash-range bypass in the native HTTP agent and no HTTP_PROXY fallback in the native HTTPS agent. Built-in fetch and imported EnvHttpProxyAgent did fall back to HTTP_PROXY when HTTPS_PROXY was absent. SOCKS, HTTPS proxy transport, other versions, physical phones, real exit IPs and throughput were not tested. The POSIX startup commands were checked through Windows process environment/flag equivalence; Linux/macOS shell syntax was not executed.

Read the corrected Node.js examples and dated runtime note, or download the separate anonymous Node.js compatibility supplement (JSON). The original five-client JSON and evidence ZIP remain the dated 12 October artifacts.

Developer checklist

  • Keep proxy credentials outside source control.
  • Use explicit connect and read timeouts.
  • Separate retry logic from proxy rotation logic.
  • Retry only safe requests unless your app is idempotent.
  • Log status code, proxy ID and elapsed time for every failed request.
  • Use the proxy tester before changing code.

Static or rotating proxies for code?

Use static private proxies while building and debugging because the network path stays stable. Add rotation only after the request flow is reliable and the target can tolerate session changes. For logged-in flows, carts and dashboards, sticky sessions are usually safer.

For API testing, proxies are useful for location checks, failover behavior and CDN routing tests. They are not a replacement for proper rate-limit handling.

FAQ

Should proxy credentials be in environment variables?

Yes. Environment variables or secret managers are safer than hardcoding credentials in source files.

Why does cURL work but my code fails?

Your library may use a different proxy format, ignore environment variables, reject the certificate path or use a shorter timeout.

What is the first debugging step?

Test the same proxy and target outside the application, then compare the exact request format.

Download the reproducible evidence bundle (ZIP): the sanitized five-client matrix, anonymous concurrency results, method links, SHA-256 checksums and the HTTPS reproducer. The local compatibility tests and provider-request measurements have separate methods and limits.

Related BuyProxies guides

These related pages help connect the setup, troubleshooting and buying decisions instead of treating each proxy problem in isolation.

Proxy authentication failed

Use this guide as the next step when you need a more specific proxy workflow.

HTTP 407 proxy authentication required

Use this guide as the next step when you need a more specific proxy workflow.

Proxy timeout errors

Use this guide as the next step when you need a more specific proxy workflow.

Best proxies for scraping

Use this guide as the next step when you need a more specific proxy workflow.

How many proxies for scraping

Use this guide as the next step when you need a more specific proxy workflow.

How many proxies for multiple accounts

Use this guide as the next step when you need a more specific proxy workflow.

Order clarity

What you receive

Check current plans
  • What you receive

    Proxy connection details for the package processed through the live order form.

  • Protocols

    HTTP or SOCKS5 options are shown during configuration for supported packages.

  • Authentication

    Set the requested proxy credentials during configuration before checkout.

  • Locations

    Current location availability is shown in the selector and can change with inventory.

  • Support and checking

    Support can help verify connection details and review replacement requests under the service policy.

Reproduce the PowerShell argument boundary

A local fixture can check command routing and synthetic authentication without contacting a provider. Use the measured Windows PowerShell example to distinguish a zero process exit code from a correctly routed proxy request.

Scroll to Top