Proxy Auto-Configuration (PAC) Syntax Builder & Sandbox Evaluator
Design, validate, and debug enterprise Proxy Auto-Configuration (PAC) scripts and FindProxyForURL() logic. Test IP subnets, CIDR blocks, regex URL rules, and fallback proxy chains in an isolated client-side JavaScript sandbox.Documentation & FAQs ↓
HTTP Proxy PAC File Syntax Builder & Sandbox URL Tester
Standard Netscape FindProxyForURL(url, host) generator, RFC1918 subnet rules & interactive regex sandbox.
Primary Proxy Node
Failover Routing
Direct Bypass Exceptions
Interactive PAC Sandbox URL Evaluator
/**
* Proxy Auto-Configuration (PAC) Script
* Generated via AnshuTechy PAC Builder
*/
function FindProxyForURL(url, host) {
// Convert host to lowercase for consistent matching
host = host.toLowerCase();
// 1. Plain hostnames without dots (e.g. "http://intranet/") route direct
if (isPlainHostName(host)) {
return "DIRECT";
}
// 2. Localhost and loopback interfaces route direct
if (host === "localhost" || host === "127.0.0.1" || host === "::1") {
return "DIRECT";
}
// 3. Explicit domain wildcard bypass list
if (shExpMatch(host, "*.internal")) {
return "DIRECT";
}
if (shExpMatch(host, "*.local")) {
return "DIRECT";
}
if (shExpMatch(host, "*.company-dev.net")) {
return "DIRECT";
}
// 4. RFC1918 Private IP Subnets (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
var resolvedIp = dnsResolve(host);
if (resolvedIp) {
if (isInNet(resolvedIp, "10.0.0.0", "255.0.0.0") ||
isInNet(resolvedIp, "172.16.0.0", "255.240.0.0") ||
isInNet(resolvedIp, "192.168.0.0", "255.255.0.0") ||
isInNet(resolvedIp, "127.0.0.0", "255.0.0.0")) {
return "DIRECT";
}
}
// 5. Default corporate gateway proxy with failover
return "PROXY proxy.corp.internal:8080; DIRECT";
}
Step-by-Step Instructions
4 Steps to CompletionAdd your routing rules using the visual builder or write custom JavaScript inside the FindProxyForURL editor.
Specify primary proxy servers, secondary fallback proxies, and direct internet bypass conditions.
Enter test destination URLs (e.g., https://internal.corp.local, https://github.com) and mock client IP addresses.
Click 'Evaluate PAC' to see the exact proxy string returned, execution path traced, and export the ready-to-deploy .pac file.
Practical Use Cases & Real-World Scenarios
Visual Rule Builder & PAC Generator
Construct corporate proxy bypass rules visually with conditions for local hosts, internal subnets (isInNet), wildcard domains (shExpMatch), and protocol schemes.
Client-Side FindProxyForURL Sandbox
Evaluates PAC logic in an isolated web sandbox, testing simulated target URLs and client IPs to verify which proxy string ('PROXY host:port', 'DIRECT', 'SOCKS5') is returned.
Built-In PAC API Function Mocking
Accurately simulates standard PAC helper functions including isInNet(), isPlainHostName(), dnsDomainIs(), dnsDomainLevels(), and myIpAddress().
Performance & DNS Re-Resolution Linter
Flags dangerous performance anti-patterns such as blocking dnsResolve() calls inside high-frequency evaluation loops and missing fallback DIRECT directives.
Frequently Asked Questions
What is a PAC file and how does FindProxyForURL() work?↓
Why should you avoid dnsResolve() in PAC files whenever possible?↓
What is the difference between shExpMatch() and dnsDomainIs()?↓
How do fallback proxy chains work in PAC files?↓
What MIME type must web servers use when serving PAC files?↓
15 Best Free Proxy Server Websites in 2026
Dive deeper into the foundational technical concepts behind this tool on our editorial blog. Includes comprehensive hardware benchmarks, case studies, and best practices.
Found this tool helpful? Share it with colleagues & friends:
100% free, private in-browser utility with zero server uploads.
