Tutorials

How to Configure Proxies for Self-Hosted Firecrawl and RAG Pipelines

By IPMusk TeamUpdated 2 min read

Configure PROXY_SERVER, PROXY_USERNAME, and PROXY_PASSWORD in self-hosted Firecrawl's root .env file and recreate both api and playwright-service containers so outbound crawls never expose your host IP. Route bulk public page extraction through Rotating Residential, reserve Static ISP for consistent allowlisted sources, and enable BLOCK_MEDIA to cut unnecessary bandwidth.

IPMusk RAG pipeline guide diagram showing self-hosted Firecrawl crawler environment isolating host IP, routing between Rotating Residential and Static ISP pools, and delivering clean Markdown to RAG
Self-hosted Firecrawl proxy routing architecture: isolate host IPs via .env credentials, split Rotating Residential vs. Static ISP traffic, and feed clean Markdown into RAG storage.

Configure PROXY_SERVER and credentials for self-hosted Firecrawl

When you self-host Firecrawl for a Retrieval-Augmented Generation (RAG) ingestion pipeline, outbound requests run from both the API server and its companion Playwright browser service. Leaving proxy variables blank sends every fetch directly from your host VM or Kubernetes node, exposing your origin server IP and concentrating all target traffic onto one datacenter address.

In Firecrawl's official self-hosted environment template (apps/api/.env.example), proxy support is configured through four dedicated variables: PROXY_SERVER, PROXY_USERNAME, PROXY_PASSWORD, and BLOCK_MEDIA.

Always check that both the api and playwright-service containers reload when editing your root .env file, and keep live credentials in deployment secrets rather than committing real passwords into git:

  • Reload running containers cleanly with docker compose up -d --force-recreate api playwright-service after updating .env.
  • Set BLOCK_MEDIA=true on text-focused RAG jobs so Playwright skips large images and media streams over metered residential gigabytes.
  • IPMusk proxy connections authenticate via username and password only; IP allowlisting is not supported.
env: placeholder Firecrawl .env proxy block (replace with active credentials)
PROXY_SERVER=http://gate.ipmusk.com:31212
PROXY_USERNAME=USERNAME
PROXY_PASSWORD=PASSWORD
BLOCK_MEDIA=true

Split RAG sources between Rotating Residential and Static ISP

Not every URL in a RAG knowledge base behaves the same. Public documentation portals and high-volume web discovery workloads hit different rate limits than partner dashboards or regional knowledge bases that expect consistent session cookies.

Matching the right IPMusk proxy line to each job keeps traffic bills predictable and prevents rotation from breaking stateful sessions:

Proxy line selection for self-hosted RAG ingestion workloads
RAG ingestion patternRecommended IPMusk productKey routing behavior
Public docs, changelogs, and wide HTML discoveryRotating Residential (from $2.99 for 1 GB Trial; down to $0.80/GB at 1,000 GB)Connects via gate.ipmusk.com:31212 with rotating or 1/3/10/30-min sticky exits; country and available state targeting
Authorized portals, partner feeds, or long cookie sessionsStatic ISP (Native ISP or ISP from $3.99/IP per 30 days)Assigned dedicated IP with host/port per resource, unmetered traffic, 30 or 90 day manual or balance-capped renewal
Permissive internal-facing mirrors or uptime pollsDatacenter (from $2.99/IP per 30 days)Lowest-cost unmetered hosting-provider IP when targets accept datacenter ASNs

For country or available state selection on IPMusk Rotating Residential, use the generated username parameters from your workspace Connect screen or build_proxy_url via MCP.

Separate 407 auth bugs from 403/429 blocks before writing to vector DB

Before scheduling automated RAG refreshes across hundreds of URLs, validate your exact proxy host, port, username, and password independently so a credential typo never gets confused with target rate limiting.

Run IPMusk's free Proxy Checker (/tools/proxy-checker) against your chosen line, or validate the placeholder environment shape locally with Python without making a live fetch:

  • HTTP 407 Proxy Authentication Required: stop the batch immediately and verify PROXY_USERNAME, PROXY_PASSWORD, and port match your active 30-day residential plan or Static ISP resource.
  • HTTP 403 Forbidden: separate gateway rules from destination access policies (/blog/proxy-403-forbidden) rather than looping retries infinitely.
  • HTTP 429 Too Many Requests: honor Retry-After headers and bound crawl concurrency (/blog/proxy-429-too-many-requests) so empty or error pages are never chunked into your vector index.
Python: validate Firecrawl proxy env variables before container restart (syntax checked)
import os
from urllib.parse import urlsplit

server = os.environ.get("PROXY_SERVER", "http://gate.ipmusk.com:31212")
user = os.environ.get("PROXY_USERNAME", "USERNAME")
pwd = os.environ.get("PROXY_PASSWORD", "PASSWORD")
parsed = urlsplit(server)
assert parsed.scheme in {"http", "https", "socks5"} and parsed.hostname and parsed.port
assert bool(user and pwd)
print({"scheme": parsed.scheme, "host": parsed.hostname, "port": parsed.port})

Sources checked

All documentation and repository templates verified HTTP 200 on December 1, 2026.