In this series of articles: A comprehensive guide to setting up proxy servers in Windows 10/11 and Linux operating systems (Ubuntu, Debian, CentOS). You will learn all configuration methods — from the graphical interface to the command line, registry, environment variables, PAC files, and automatic setup. The material is up to date for 2025, taking into account the latest operating system updates.
📑 Table of Contents - Part 1 (Windows)
- Introduction: Why set up a proxy in Windows
- Configuring a proxy in Windows 11 via GUI
- Configuring a proxy in Windows 10
- Classic Control Panel (Internet Options)
- Configuration via Windows Registry
- Configuration via PowerShell
- Configuration via Command Line (netsh)
- Environment Variables in Windows
- Configuration for Specific Applications
🪟 Introduction: Why set up a proxy in Windows
Configuring a proxy server in Windows is an essential skill for working within corporate networks, bypassing regional restrictions, protecting privacy, and automating web scraping. In 2025, Windows offers multiple ways to configure proxies, ranging from a simple graphical interface to powerful command-line tools.
Main Use Cases for Proxies in Windows
🏢 Corporate Networks
Most companies require the use of a corporate proxy for internet access, traffic control, and security enforcement.
🔒 Privacy
Using a proxy allows you to hide your real IP address, protect personal data, and bypass regional restrictions.
⚙️ Automation
For web scraping, data parsing, and automated testing, proxies are essential for IP rotation and bypassing rate limits.
🌍 Geolocation
Accessing content from different countries for testing, price monitoring, and service availability checks.
✅ What You Will Learn in This Part
- Configuring proxies via the Windows 10 and 11 graphical interface
- Using the classic Control Panel
- Working with the Windows Registry for advanced tweaks
- Automation via PowerShell and the command line
- Configuring environment variables
- Proxy configuration for specific applications
🎨 Configuring a Proxy in Windows 11 via GUI
Windows 11 features a refreshed settings interface with improved navigation. In 2025, this method is the simplest and recommended for most users.
Step-by-Step Guide
Step 1: Opening Settings
Press Windows + I or open the Start menu and select the gear icon (Settings).
💡 Tip: You can also right-click the network icon in the system tray and select "Network settings".
Step 2: Navigating to Proxy Settings
In the Settings window, select:
- Network & internet in the left pane
- Scroll down and select Proxy
Step 3: Choosing the Configuration Method
Windows 11 offers three ways to configure a proxy:
🔄 Automatically detect settings
Enabled by default. Windows attempts to automatically discover proxy settings via DHCP or DNS.
📜 Use setup script
For PAC (Proxy Auto-Config) files. Enter the configuration script URL.
⚙️ Manual proxy setup
The most common method. Enter the proxy server IP and port manually.
Step 4: Manual Proxy Configuration
- Under "Manual proxy setup", click the Set up button
- Toggle the switch for "Use a proxy server"
- Enter the proxy server IP address or domain name
- Enter the Port (typically 8080, 3128, 80, or another)
- (Optional) In the "Don't use the proxy server for addresses..." field, add exceptions
- Click Save
Configuration Example:
Proxy IP address: 192.168.1.100
Port: 8080
Don't use proxy for:
localhost;127.0.0.1;*.local;192.168.*
⚠️ Important: Proxy settings in Windows 11 are applied system-wide for all applications using WinHTTP and WinINET APIs. However, some applications (such as Firefox) use their own proxy settings.
🖥️ Configuring a Proxy in Windows 10
The proxy configuration process in Windows 10 is very similar to Windows 11, with minor interface differences. This method remains relevant in 2025 for millions of users.
Instructions for Windows 10
Method 1: Via Windows Settings
- Press Windows + I to open Settings
- Select Network & Internet
- In the left pane, select Proxy
- Under "Manual proxy setup", toggle "Use a proxy server" to On
- Enter the address and port
- Click Save
Configuring Exceptions
To bypass the proxy for specific addresses, add them to the exceptions field:
localhost;127.0.0.1;*.local;intranet.company.com
Addresses are separated by semicolons. Wildcards (*) can be used.
🎛️ Classic Control Panel (Internet Options)
An older yet still functional method for configuring proxies via the "Internet Properties" window. This approach provides advanced configuration options not available in the modern Windows interface.
Accessing Internet Options
Ways to Open It:
1️⃣ Via the Run Command
Press Windows + R and enter:
inetcpl.cpl
2️⃣ Via Control Panel
Control Panel → Network and Internet → Internet Options
3️⃣ Via Internet Explorer
Menu → Tools → Internet Options
Configuring the Proxy
- Open the Connections tab
- Click the LAN settings button
- Under "Proxy server", check the box for "Use a proxy server for your LAN"
- Click the Advanced button for detailed settings
Advanced Proxy Settings
The "Advanced" button allows you to configure different proxies for various protocols:
| Protocol | Proxy Address | Port |
|---|---|---|
| HTTP | 192.168.1.100 | 8080 |
| Secure (HTTPS) | 192.168.1.100 | 8443 |
| FTP | 192.168.1.100 | 2121 |
| Socks | 192.168.1.100 | 1080 |
✅ Advantage: You can assign different proxies to different types of traffic.
📝 Configuration via Windows Registry
The Windows Registry is a powerful tool for directly managing system settings. This method is suitable for advanced users and script-based automation.
⚠️ Warning: Incorrect registry editing can disrupt system stability. Create a registry backup before making any changes. Use this method only if you fully understand what you are doing.
Registry Keys for Proxies
Settings Location
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Main Parameters
| Parameter | Type | Value | Description |
|---|---|---|---|
| ProxyEnable | DWORD | 1 | Enable proxy (0 = disable) |
| ProxyServer | String | 192.168.1.100:8080 | Proxy address and port |
| ProxyOverride | String | localhost;127.*;*.local | Exceptions (addresses without proxy) |
| AutoConfigURL | String | http://proxy/proxy.pac | PAC file URL |
Example REG File for Import
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="192.168.1.100:8080"
"ProxyOverride"="localhost;127.0.0.1;*.local"
Save this text to a file with a .reg extension and double-click it to import into the registry.
⚡ Configuration via PowerShell
PowerShell is a modern and powerful tool for automating Windows settings. It is ideal for mass proxy deployment across multiple computers or automated configuration scripts.
PowerShell Commands for Proxy Management
Enabling a Proxy
# Set the proxy server address
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
-Name ProxyServer -Value "192.168.1.100:8080"
# Enable the proxy
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
-Name ProxyEnable -Value 1
# Apply changes (notify the system)
$signature = @'
[DllImport("wininet.dll")]
public static extern bool InternetSetOption(int hInternet, int dwOption, int lpBuffer, int dwBufferLength);
'@
$type = Add-Type -MemberDefinition $signature -Name wininet -Namespace pinvoke -PassThru
$type::InternetSetOption(0, 39, 0, 0) | Out-Null
Disabling the Proxy
# Disable the proxy
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
-Name ProxyEnable -Value 0
Checking Current Settings
# Get all proxy settings
Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | `
Select-Object ProxyEnable, ProxyServer, ProxyOverride, AutoConfigURL
Ready-to-Use Proxy Function
function Set-Proxy {
param(
[Parameter(Mandatory=$true)]
[string]$Server,
[Parameter(Mandatory=$true)]
[int]$Port,
[string]$Override = "localhost;127.0.0.1;*.local"
)
$proxyString = "${Server}:${Port}"
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $regPath -Name ProxyServer -Value $proxyString
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 1
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value $Override
Write-Host "Proxy configured: $proxyString" -ForegroundColor Green
}
# Usage:
Set-Proxy -Server "192.168.1.100" -Port 8080
💻 Configuration via Command Line (netsh)
The netsh (Network Shell) utility is a classic Windows command-line tool for managing network settings, including WinHTTP proxy configurations.
netsh winhttp Commands
Setting a Proxy
netsh winhttp set proxy proxy-server="192.168.1.100:8080" bypass-list="localhost;*.local"
Importing Settings from IE
netsh winhttp import proxy source=ie
Imports proxy settings from Internet Explorer into WinHTTP.
Viewing Current Settings
netsh winhttp show proxy
Resetting Proxy Settings
netsh winhttp reset proxy
💡 Tip: netsh winhttp commands affect the system-level WinHTTP, which is used by Windows Update, PowerShell, and many system applications, but they do NOT affect Internet Explorer/Edge browser settings.
🌐 Environment Variables in Windows
Many console utilities and applications use environment variables to determine the proxy server. This is especially important for Python, Node.js, Git, curl, and other development tools.
Standard Proxy Variables
Setting via Command Line (Temporary)
set HTTP_PROXY=http://192.168.1.100:8080
set HTTPS_PROXY=http://192.168.1.100:8080
set NO_PROXY=localhost,127.0.0.1,.local
These variables apply only to the current command-line session.
Setting via GUI (Permanent)
- Open "System" properties (Windows + Pause)
- Click "Advanced system settings"
- Go to the "Advanced" tab → "Environment Variables"
- Under "User variables", click "New"
- Add the HTTP_PROXY and HTTPS_PROXY variables
Setting via PowerShell (Permanent)
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://192.168.1.100:8080", "User")
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", "http://192.168.1.100:8080", "User")
[Environment]::SetEnvironmentVariable("NO_PROXY", "localhost,127.0.0.1", "User")
Authentication Format
set HTTP_PROXY=http://username:[email protected]:8080
set HTTPS_PROXY=http://username:[email protected]:8080
⚠️ Special characters in passwords must be URL-encoded (@ → %40, : → %3A)
🎯 Configuration for Specific Applications
Some applications do not use system proxy settings and require their own configuration. Let us examine the most popular tools.
🦊 Firefox
Firefox uses its own proxy settings:
- Menu → Settings → General (Network Settings)
- Click "Settings"
- Manual proxy configuration
- Enter address and port
📦 Git
Configuring a proxy for Git:
git config --global http.proxy http://192.168.1.100:8080
git config --global https.proxy http://192.168.1.100:8080
🐍 Python pip
Configuring for pip:
pip install package_name --proxy http://192.168.1.100:8080
📦 npm
Configuring for npm:
npm config set proxy http://192.168.1.100:8080
npm config set https-proxy http://192.168.1.100:8080
🎁 ProxyCove — Reliable Proxies for Windows: Support for all authentication methods (IP whitelist and login:password), compatibility with any application, 24/7 technical support. Register → and get +$1.3 using the promo code ARTHELLO
To Be Continued...
In the next part: configuring proxies in Linux (Ubuntu, Debian, CentOS), environment variables, setting up apt/yum through a proxy
Configuring a Proxy in Linux: Ubuntu, Debian, CentOS — Part 2
In this part: A detailed guide on configuring proxy servers across various Linux distributions — Ubuntu, Debian, CentOS, and RHEL. We will cover system environment variables, GUI configuration, apt and yum package manager setups, as well as application-specific configurations. The material is up to date for 2025.
📑 Table of Contents - Part 2 (Linux)
- Features of proxy configuration in Linux
- Environment variables (http_proxy, https_proxy)
- System-wide configuration (/etc/environment)
- Configuration in Ubuntu/Debian
- Configuration in CentOS/RHEL
- Configuring APT through a proxy
- Configuring YUM/DNF through a proxy
- Configuration in .bashrc and .profile
- Configuring for applications (curl, wget, git)
🐧 Features of Proxy Configuration in Linux
Unlike Windows, Linux does not have a single centralized location for configuring a proxy server. Instead, various methods are used: environment variables, configuration files, individual application settings, and graphical interfaces (in desktop distributions).
Main Approaches to Proxy Configuration in Linux
🌐 Environment Variables
The most common method. The http_proxy, https_proxy, and no_proxy variables are used by most console utilities.
📝 Configuration Files
Files such as /etc/environment, /etc/profile, and ~/.bashrc for system-wide and user-specific settings.
📦 Package Managers
APT and YUM/DNF require separate configuration within their own configuration files.
🎨 Graphical Interface
GNOME, KDE, and other desktop environments provide a GUI for proxy configuration (only for desktop versions).
⚠️ Important Points
- Linux has no mandatory standard for proxies — each application may ignore system settings
- Environment variables must be set in both lowercase and uppercase (HTTP_PROXY and http_proxy)
- APT and YUM do NOT use system environment variables automatically
- For server editions (without a GUI), rely solely on the command line and configuration files
🔧 Environment Variables (http_proxy, https_proxy)
Environment variables are the standard way to configure proxies in Linux for console applications. Most utilities (curl, wget, apt-get when properly configured) read these variables.
Standard Proxy Variables
List of Main Variables
| Variable | Format | Description |
|---|---|---|
| http_proxy | http://proxy:8080 | Proxy for HTTP traffic |
| https_proxy | http://proxy:8080 | Proxy for HTTPS traffic |
| ftp_proxy | http://proxy:8080 | Proxy for FTP traffic |
| no_proxy | localhost,127.0.0.1,.local | Addresses bypassing the proxy (exceptions) |
| HTTP_PROXY | http://proxy:8080 | Duplicates http_proxy (uppercase) |
| HTTPS_PROXY | http://proxy:8080 | Duplicates https_proxy (uppercase) |
Temporary Setup (Current Session)
export http_proxy="http://192.168.1.100:8080"
export https_proxy="http://192.168.1.100:8080"
export ftp_proxy="http://192.168.1.100:8080"
export no_proxy="localhost,127.0.0.1,*.local"
# Duplicate in uppercase for compatibility
export HTTP_PROXY="http://192.168.1.100:8080"
export HTTPS_PROXY="http://192.168.1.100:8080"
export NO_PROXY="localhost,127.0.0.1,*.local"
These variables will only be active during the current terminal session.
With Authentication
export http_proxy="http://username:[email protected]:8080"
export https_proxy="http://username:[email protected]:8080"
⚠️ If your password contains special characters, use URL encoding: @ → %40, : → %3A
Checking Configured Variables
# Show all proxy-related variables
env | grep -i proxy
# Check a specific variable
echo $http_proxy
echo $https_proxy
Disabling the Proxy
unset http_proxy
unset https_proxy
unset ftp_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset FTP_PROXY
🌍 System-Wide Configuration (/etc/environment)
The /etc/environment file contains system-wide environment variables that apply to all users and are loaded during system startup.
Permanent System-Wide Configuration
Step 1: Editing the File
sudo nano /etc/environment
Step 2: Adding Variables
Add the following lines to the end of the file:
http_proxy="http://192.168.1.100:8080"
https_proxy="http://192.168.1.100:8080"
ftp_proxy="http://192.168.1.100:8080"
no_proxy="localhost,127.0.0.1,*.local"
HTTP_PROXY="http://192.168.1.100:8080"
HTTPS_PROXY="http://192.168.1.100:8080"
FTP_PROXY="http://192.168.1.100:8080"
NO_PROXY="localhost,127.0.0.1,*.local"
Step 3: Applying Changes
# Reboot the system (recommended)
sudo reboot
# Or apply for the current session
source /etc/environment
💡 Tip: The /etc/environment file does not support variable expansion or command execution. Use simple values only. For more complex logic, use /etc/profile or /etc/bash.bashrc.
🐧 Configuration in Ubuntu/Debian
Ubuntu and Debian are the most popular Linux distributions. Let us examine both GUI configuration (for desktop versions) and command-line configuration (for servers).
🎨 Via GUI (Ubuntu Desktop)
GNOME Settings
- Open Settings
- Select Network
- Click the gear icon next to your connection
- Go to the Proxy tab
- Select Manual
- Enter the address and port for HTTP, HTTPS, FTP, and Socks
- Click Apply
⌨️ Via Command Line
gsettings (for GNOME)
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http host '192.168.1.100'
gsettings set org.gnome.system.proxy.http port 8080
🔴 Configuration in CentOS/RHEL
CentOS and Red Hat Enterprise Linux share a similar configuration structure. In 2025, many users are migrating to Rocky Linux and AlmaLinux, where the same principles apply.
System-Wide Configuration for RHEL-based Systems
Method 1: /etc/profile.d/
Create a configuration file for proxy settings:
sudo nano /etc/profile.d/proxy.sh
Add the following content:
#!/bin/bash
export http_proxy="http://192.168.1.100:8080"
export https_proxy="http://192.168.1.100:8080"
export ftp_proxy="http://192.168.1.100:8080"
export no_proxy="localhost,127.0.0.1,*.local"
export HTTP_PROXY="http://192.168.1.100:8080"
export HTTPS_PROXY="http://192.168.1.100:8080"
export FTP_PROXY="http://192.168.1.100:8080"
export NO_PROXY="localhost,127.0.0.1,*.local"
Make the file executable: sudo chmod +x /etc/profile.d/proxy.sh
Method 2: /etc/environment
The same approach as Ubuntu/Debian — edit /etc/environment.
📦 Configuring APT through a Proxy
Important: APT (Advanced Package Tool) in Ubuntu/Debian does NOT use system environment variables automatically. A separate configuration is required to route it through a proxy.
Proxy Configuration for APT
Method 1: apt.conf.d/ (Recommended)
Create a configuration file:
sudo nano /etc/apt/apt.conf.d/02proxy
Add the following content:
Acquire::http::Proxy "http://192.168.1.100:8080";
Acquire::https::Proxy "http://192.168.1.100:8080";
Acquire::ftp::Proxy "http://192.168.1.100:8080";
With Authentication
Acquire::http::Proxy "http://username:[email protected]:8080";
Acquire::https::Proxy "http://username:[email protected]:8080";
Method 2: Temporary Setup (Single Command)
sudo apt-get -o Acquire::http::proxy="http://192.168.1.100:8080" update
Applies only to the current apt command execution.
Checking APT Settings
# Display current APT settings
apt-config dump | grep -i proxy
# Test update through proxy
sudo apt-get update
Exceptions (Bypassing Proxy for Specific Hosts)
Acquire::http::Proxy "http://192.168.1.100:8080";
Acquire::http::Proxy::ppa.launchpad.net "DIRECT";
"DIRECT" means a direct connection without a proxy for the specified host.
📦 Configuring YUM/DNF through a Proxy
YUM (for CentOS 7 and earlier) and DNF (for CentOS 8+, Fedora, Rocky Linux, AlmaLinux) are package managers for Red Hat-based distributions. They also require separate proxy configurations.
Global YUM/DNF Configuration
YUM (CentOS 7 and Earlier)
Edit the configuration file:
sudo nano /etc/yum.conf
Add to the [main] section:
[main]
proxy=http://192.168.1.100:8080
proxy_username=your_username
proxy_password=your_password
If the proxy does not require authentication, omit proxy_username and proxy_password.
DNF (CentOS 8+, Fedora, Rocky Linux)
Edit the configuration file:
sudo nano /etc/dnf/dnf.conf
Add to the [main] section:
[main]
proxy=http://192.168.1.100:8080
proxy_username=your_username
proxy_password=your_password
Configuring for a Specific Repository
You can set up a proxy for a specific repository within the /etc/yum.repos.d/*.repo files:
[epel]
name=Extra Packages for Enterprise Linux 8
baseurl=https://download.fedoraproject.org/pub/epel/8/$basearch
proxy=http://192.168.1.100:8080
proxy_username=username
proxy_password=password
Disabling Proxy for a Specific Repository
[local-repo]
name=Local Repository
baseurl=http://192.168.1.50/repo
proxy=_none_
proxy=_none_ disables the proxy for this specific repository.
Checking Settings
# For YUM
sudo yum repolist
# For DNF
sudo dnf repolist
# Show configuration
sudo dnf config-manager --dump | grep -i proxy
👤 Configuration in .bashrc and .profile
For user-specific proxy settings that apply only to a particular user, use the .bashrc or .profile files in your home directory.
User-Specific Configuration
Editing .bashrc
nano ~/.bashrc
Add to the end of the file:
# Proxy settings
export http_proxy="http://192.168.1.100:8080"
export https_proxy="http://192.168.1.100:8080"
export ftp_proxy="http://192.168.1.100:8080"
export no_proxy="localhost,127.0.0.1,*.local"
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
export FTP_PROXY=$ftp_proxy
export NO_PROXY=$no_proxy
Apply changes:
source ~/.bashrc
Creating Functions for Proxy Management
# Function to enable proxy
proxy_on() {
export http_proxy="http://192.168.1.100:8080"
export https_proxy="http://192.168.1.100:8080"
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
echo "Proxy enabled"
}
# Function to disable proxy
proxy_off() {
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
echo "Proxy disabled"
}
# Function to check proxy status
proxy_status() {
echo "http_proxy: $http_proxy"
echo "https_proxy: $https_proxy"
}
Usage: proxy_on, proxy_off, proxy_status
🛠️ Configuring for Applications (curl, wget, git)
Some popular utilities feature their own proxy configuration methods or configuration files.
📡 curl
curl uses environment variables, but you can also specify a proxy via parameters:
curl -x http://192.168.1.100:8080 https://example.com
# With authentication
curl -x http://user:[email protected]:8080 https://example.com
# Via .curlrc
echo 'proxy = "http://192.168.1.100:8080"' >> ~/.curlrc
📥 wget
wget also uses environment variables, but has its own configuration file:
# ~/.wgetrc
http_proxy = http://192.168.1.100:8080
https_proxy = http://192.168.1.100:8080
use_proxy = on
🔧 git
Git has its own proxy configuration system:
# Globally for all repositories
git config --global http.proxy http://192.168.1.100:8080
git config --global https.proxy http://192.168.1.100:8080
# For a specific repository
git config http.proxy http://192.168.1.100:8080
# Disable proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
🐳 Docker
Docker requires proxy configuration for both the daemon and the client:
# /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.100:8080"
Environment="HTTPS_PROXY=http://192.168.1.100:8080"
Environment="NO_PROXY=localhost,127.0.0.1"
🎁 ProxyCove — Professional Proxies for Linux: Full compatibility with all distributions, IP whitelist and authentication support, works with any application. Register → and get +$1.3 using the promo code ARTHELLO
The Final Part is Coming Soon!
In the concluding part: PAC files, automatic setup, troubleshooting common issues, and conclusions
PAC Files, Automatic Setup, and Troubleshooting — Finale
In this final part: A complete guide to PAC (Proxy Auto-Configuration) files, the WPAD protocol for automatic proxy discovery, diagnostics, and troubleshooting common proxy issues in Windows and Linux. Final recommendations and best practices for 2025.
📑 Table of Contents - Final Part
📜 What Are PAC Files
PAC (Proxy Auto-Configuration) is a JavaScript file that automatically determines which proxy server to use for a specific URL. This enables flexible traffic routing rules without requiring manual configuration on every client machine.
Advantages of PAC Files
✅ Flexibility
Different proxies for different websites, direct access for local resources, and fault tolerance with multiple proxies.
✅ Centralization
A single change in the PAC file applies to all clients without needing to reconfigure each individual computer.
✅ Condition-Based Logic
Proxy selection based on domain, IP subnet, time of day, day of the week, and other factors.
✅ Performance
Load balancing between multiple proxy servers and automatic failover switching when one becomes unavailable.
When to Use PAC Files
- Corporate networks — different proxies for internal and external resources
- Complex routing — different proxies for different countries or services
- Redundancy — automatic failover switching to a backup proxy if the primary fails
- Optimization — directing traffic along the most efficient path
💻 Syntax and Structure of PAC Files
A PAC file is a plain text file with a .pac extension containing a JavaScript function named FindProxyForURL(url, host).
Basic Structure
function FindProxyForURL(url, host) {
// Your logic here
// Returns a string with proxy settings
return "PROXY proxy.example.com:8080";
}
Function Parameters
| Parameter | Description | Example |
|---|---|---|
| url | The full URL requested by the browser | https://example.com/page |
| host | The domain name extracted from the URL | example.com |
Return Values
| Value | Description |
|---|---|
DIRECT |
Direct connection without a proxy |
PROXY host:port |
HTTP/HTTPS proxy |
SOCKS host:port |
SOCKS proxy (v4/v5) |
SOCKS5 host:port |
Explicitly SOCKS5 |
PROXY p1:8080; PROXY p2:8080; DIRECT |
Multiple options (fallback chain) |
Built-in PAC Functions
| Function | Description |
|---|---|
isPlainHostName(host) |
Checks if the host is a simple name (without dots) |
dnsDomainIs(host, domain) |
Checks if the host belongs to the specified domain |
localHostOrDomainIs(host, domain) |
Compares the host with a domain |
isResolvable(host) |
Checks if the host resolves in DNS |
isInNet(host, pattern, mask) |
Checks if the IP falls within a given subnet |
shExpMatch(str, pattern) |
Pattern matching using wildcards (* and ?) |
weekdayRange(day1, day2) |
Day of the week check |
dateRange(...) |
Date range check |
timeRange(...) |
Time of day check |
📚 Practical Examples of PAC Files
Example 1: Simple Proxy for All Requests
function FindProxyForURL(url, host) {
return "PROXY proxy.company.com:8080";
}
Example 2: Local Addresses Without Proxy
function FindProxyForURL(url, host) {
// Local hosts — direct connection
if (isPlainHostName(host) ||
dnsDomainIs(host, ".local") ||
isInNet(host, "192.168.0.0", "255.255.0.0") ||
isInNet(host, "10.0.0.0", "255.0.0.0") ||
host == "localhost" ||
host == "127.0.0.1")
{
return "DIRECT";
}
// Everything else through the proxy
return "PROXY proxy.company.com:8080";
}
Example 3: Different Proxies for Different Domains
function FindProxyForURL(url, host) {
// Social networks via a dedicated proxy
if (shExpMatch(host, "*.facebook.com") ||
shExpMatch(host, "*.twitter.com") ||
shExpMatch(host, "*.instagram.com"))
{
return "PROXY social-proxy.company.com:8080";
}
// Video streaming via another proxy
if (shExpMatch(host, "*.youtube.com") ||
shExpMatch(host, "*.netflix.com"))
{
return "PROXY video-proxy.company.com:8080";
}
// Local resources directly
if (isInNet(host, "10.0.0.0", "255.0.0.0"))
{
return "DIRECT";
}
// Everything else through the main proxy
return "PROXY main-proxy.company.com:8080";
}
Example 4: Fault Tolerance with Fallback
function FindProxyForURL(url, host) {
// Local addresses directly
if (isPlainHostName(host) ||
isInNet(host, "192.168.0.0", "255.255.0.0"))
{
return "DIRECT";
}
// Try primary proxy, then backup proxy, then direct connection
return "PROXY proxy1.company.com:8080; " +
"PROXY proxy2.company.com:8080; " +
"DIRECT";
}
The browser will attempt to connect via proxy1, fallback to proxy2 if it fails, and fall back to a direct connection if both fail.
Example 5: Time-Dependent Routing
function FindProxyForURL(url, host) {
// During working hours (8:00-18:00) on weekdays
if (weekdayRange("MON", "FRI") &&
timeRange(8, 18))
{
return "PROXY work-proxy.company.com:8080";
}
// Evenings and weekends — a different proxy
return "PROXY night-proxy.company.com:8080";
}
Example 6: Comprehensive Corporate Configuration
function FindProxyForURL(url, host) {
// Local hosts without proxy
if (isPlainHostName(host) ||
dnsDomainIs(host, ".local") ||
dnsDomainIs(host, ".company.com") ||
isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "172.16.0.0", "255.240.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0") ||
host == "localhost" ||
host == "127.0.0.1")
{
return "DIRECT";
}
// HTTPS traffic through a dedicated SSL proxy
if (url.substring(0, 6) == "https:")
{
return "PROXY ssl-proxy.company.com:8443; DIRECT";
}
// Media content through a caching proxy
if (shExpMatch(url, "*.mp4") ||
shExpMatch(url, "*.mp3") ||
shExpMatch(url, "*.jpg") ||
shExpMatch(url, "*.png"))
{
return "PROXY cache-proxy.company.com:3128";
}
// HTTP through the main proxy with failover
return "PROXY proxy1.company.com:8080; " +
"PROXY proxy2.company.com:8080; " +
"DIRECT";
}
🚀 Deploying PAC Files
Once a PAC file is created, it must be properly hosted and clients configured to use it.
Hosting the PAC File
1. Web Server (HTTP/HTTPS)
Host the proxy.pac file on a web server:
http://proxy.company.com/proxy.pac
https://proxy.company.com/proxy.pac
⚠️ The MIME type must be: application/x-ns-proxy-autoconfig
2. File System (file://)
# Windows
file:///C:/proxy.pac
file://\\server\share\proxy.pac
# Linux
file:///etc/proxy.pac
Not recommended for production environments, but convenient for testing.
Configuring MIME Type in Apache
# In httpd.conf or .htaccess
AddType application/x-ns-proxy-autoconfig .pac
Configuring MIME Type in Nginx
# In nginx.conf
types {
application/x-ns-proxy-autoconfig pac;
}
Client Configuration
Windows
Settings → Network & Internet → Proxy → "Use setup script" → Enter the PAC file URL
Linux (GNOME)
gsettings set org.gnome.system.proxy mode 'auto'
gsettings set org.gnome.system.proxy autoconfig-url 'http://proxy.company.com/proxy.pac'
Firefox
Settings → General (Network Settings) → Settings → Automatic proxy configuration URL
🔍 WPAD — Automatic Proxy Discovery
WPAD (Web Proxy Auto-Discovery Protocol) is a protocol that allows browsers to automatically discover a PAC file without requiring explicit URL configuration. In 2025, it is supported by all major browsers and operating systems.
How WPAD Works
- DHCP Method: The client requests option 252 from the DHCP server, which returns the PAC file URL
- DNS Method: The client attempts to resolve the host
wpad.domain.comvia DNS - PAC Download: If found, the client attempts to download
http://wpad.domain.com/wpad.dat
Configuring WPAD via DNS
Create an A or CNAME DNS record:
wpad.company.com. IN A 192.168.1.100
# or
wpad.company.com. IN CNAME proxy-server.company.com.
Host the PAC file at: http://wpad.company.com/wpad.dat
Configuring WPAD via DHCP
Add option 252 to your DHCP server configuration:
# ISC DHCP (dhcpd.conf)
option wpad code 252 = text;
option wpad "http://proxy.company.com/proxy.pac";
⚠️ WPAD Security Issues
- WPAD hijacking: An attacker can spoof WPAD responses and redirect traffic through their own proxy
- DNS spoofing: Poisoning the wpad.domain.com DNS record
- Recommendation: Use WPAD only within trusted corporate networks
- Alternative: Explicitly specifying the PAC file URL is safer than automatic discovery
🔧 Troubleshooting: Issue Diagnostics
Common Issues and Solutions
Issue 1: Proxy is Not Working
Symptoms: Websites fail to load, connection errors
Solutions:
- Check proxy server reachability:
ping proxy-host - Check the port:
telnet proxy-host 8080ornc -zv proxy-host 8080 - Ensure the proxy is not blocked by a firewall
- Verify the correctness of the address and port in settings
Issue 2: Error 407 (Proxy Authentication Required)
Symptoms: Authentication prompt, error code 407
Solutions:
- Verify your username and password
- Ensure you are using the correct format:
http://user:pass@proxy:port - Check if your credentials have expired
- For IP authentication: ensure your IP is added to the whitelist
- Check if your external IP address has changed
Issue 3: Slow Performance Through the Proxy
Symptoms: Slow page loading times, timeouts
Solutions:
- Check proxy speed:
curl -x proxy:port -w "@curl-format.txt" https://example.com - Try a different proxy server (if available)
- Check the load on the proxy server
- Ensure you are not routing local resources through the proxy (add exceptions)
- Check DNS settings (slow DNS can slow down proxy resolution)
Issue 4: PAC File Is Not Working
Symptoms: Automatic configuration is not applying
Solutions:
- Check PAC file reachability: open its URL in a browser
- Ensure the MIME type is correct:
application/x-ns-proxy-autoconfig - Validate the JavaScript syntax inside the PAC file
- Use PAC testing tools: pactester (Linux) or browser DevTools
- Check for caching issues: clear your browser cache
🧪 Testing Proxies
Testing Tools
Connection Check (curl)
# Check HTTP proxy
curl -x http://proxy:8080 -I https://www.google.com
# With authentication
curl -x http://user:pass@proxy:8080 https://www.google.com
# Show external IP (verifying proxy functionality)
curl -x http://proxy:8080 https://ifconfig.me
curl -x http://proxy:8080 https://api.ipify.org
Port Check (netcat)
# Linux
nc -zv proxy-host 8080
# Windows (PowerShell)
Test-NetConnection -ComputerName proxy-host -Port 8080
Testing a PAC File (Linux)
# Install pactester
sudo apt-get install libpacparser1 # Ubuntu/Debian
# Test the PAC file
pactester -p /path/to/proxy.pac -u https://www.google.com
Checking Current Settings (Windows PowerShell)
# Show current proxy settings
Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select-Object ProxyEnable, ProxyServer, AutoConfigURL
# Show WinHTTP proxy
netsh winhttp show proxy
Online Tools
- whatismyip.com — check your external IP
- ifconfig.me — display your IP in a console-friendly format
- browserleaks.com/proxy — detailed proxy leak and anonymity information
- ipleak.net — check for DNS and WebRTC leaks
🔒 Security When Using Proxies
Security Recommendations
✅ Use HTTPS Proxies
HTTPS proxies encrypt data between the client and the proxy server, protecting against traffic interception.
✅ Avoid Plaintext Passwords
Use password managers, environment variables, or encrypted configuration files.
✅ Verify Certificates
When using a MITM proxy, ensure you trust the proxy server's root certificate.
✅ Minimize DNS Leaks
Use DNS-over-HTTPS or route DNS queries through the proxy to prevent leaks.
❌ What to Avoid
- Do not use free public proxies for handling confidential data
- Do not ignore SSL certificate warnings
- Do not save proxy passwords in command history (use a leading space before commands in bash)
- Do not use unencrypted HTTP proxies for transmitting passwords
🎯 Best Practices for 2025
1️⃣ Choose the Right Proxy Type
For parsing and web scraping: Residential or mobile proxies
For corporate networks: Datacenter proxies with IP whitelists
For bypassing geo-blocks: Residential proxies from the required country
2️⃣ Use PAC Files for Complex Routing
PAC files are ideal for corporate networks where different resources require different proxies. They provide centralized management and flexibility.
3️⃣ Configure Exceptions
Local addresses (localhost, 127.0.0.1, private subnets) should not pass through the proxy. This speeds up access to local resources.
4️⃣ Implement Fault Tolerance
In PAC files, use fallback options: multiple proxies with a direct connection fallback if all proxies become unavailable.
5️⃣ Monitoring and Logging
Regularly check proxy health, monitor connection speed, and track availability. Log errors for rapid response.
6️⃣ Document Your Configuration
Create documentation detailing all proxy settings, PAC files, exceptions, and recovery procedures. This will save time during troubleshooting.
📝 Conclusions and Recommendations
Article Series Summary
Windows
In Windows, use the GUI for simple setups, PowerShell for automation, and the registry for advanced tweaks. Environment variables are essential for console utilities.
Linux
In Linux, the primary approach relies on environment variables in /etc/environment or ~/.bashrc. Remember to configure APT and YUM/DNF separately.
PAC Files
PAC files offer maximum flexibility for complex scenarios. Use them in corporate environments and for intelligent traffic routing.
Troubleshooting
Most issues can be resolved by checking proxy availability, credential correctness, and configuration settings. Use curl, netcat, and browser DevTools for diagnostics.
🏆 ProxyCove — Your Ideal Choice
Global Coverage
195+ countries
High Speed
Up to 10 Gbps
Security
IP + Login/Pass
24/7 Support
Multilingual
Affordable Prices
From $1.5/GB
API
Full integration
Ready to Start Working with Professional Proxies?
Register on ProxyCove, top up your balance using the promo code ARTHELLO, and receive +$1.3 as a bonus!