# 🌐 Proxy Configuration
**πŸ”’ Route traffic through proxy servers for privacy and flexibility** *Enhanced anonymity and geographic control*
--- ## 🎯 What Are Proxies? Proxies act as **intermediaries** between your script and Microsoft's servers, providing enhanced privacy, geographic flexibility, and network management capabilities. ### **Key Benefits** - 🎭 **IP masking** β€” Hide your real IP address - 🌍 **Geographic flexibility** β€” Appear to browse from different locations - ⚑ **Rate limiting** β€” Distribute requests across multiple IPs - πŸ”§ **Network control** β€” Route traffic through specific servers - πŸ”’ **Privacy enhancement** β€” Add layer of anonymity --- ## βš™οΈ Configuration ### **Basic Setup** ```json { "browser": { "proxy": { "enabled": false, "server": "proxy.example.com:8080", "username": "", "password": "", "bypass": [] } } } ``` ### **Configuration Options** | Setting | Description | Example | |---------|-------------|---------| | `enabled` | Enable proxy usage | `true` | | `server` | Proxy server address and port | `"proxy.example.com:8080"` | | `username` | Proxy authentication username | `"proxyuser"` | | `password` | Proxy authentication password | `"proxypass123"` | | `bypass` | Domains to bypass proxy | `["localhost", "*.internal.com"]` | --- ## πŸ”Œ Supported Proxy Types ### **HTTP Proxies** **Most common type for web traffic** ```json { "browser": { "proxy": { "enabled": true, "server": "http://proxy.example.com:8080", "username": "user", "password": "pass" } } } ``` ### **HTTPS Proxies** **Encrypted proxy connections** ```json { "browser": { "proxy": { "enabled": true, "server": "https://secure-proxy.example.com:8080", "username": "user", "password": "pass" } } } ``` ### **SOCKS Proxies** **Support for SOCKS4 and SOCKS5** ```json { "browser": { "proxy": { "enabled": true, "server": "socks5://socks-proxy.example.com:1080", "username": "user", "password": "pass" } } } ``` --- ## 🏒 Popular Proxy Providers ### **Residential Proxies (Recommended)** **High-quality IPs from real devices** #### **Top Providers** - **Bright Data** (formerly Luminati) β€” Premium quality - **Smartproxy** β€” User-friendly dashboard - **Oxylabs** β€” Enterprise-grade - **ProxyMesh** β€” Developer-focused #### **Configuration Example** ```json { "browser": { "proxy": { "enabled": true, "server": "rotating-residential.brightdata.com:22225", "username": "customer-username-session-random", "password": "your-password" } } } ``` ### **Datacenter Proxies** **Fast and affordable server-based IPs** #### **Popular Providers** - **SquidProxies** β€” Reliable performance - **MyPrivateProxy** β€” Dedicated IPs - **ProxyRack** β€” Budget-friendly - **Storm Proxies** β€” Rotating options #### **Configuration Example** ```json { "browser": { "proxy": { "enabled": true, "server": "datacenter.squidproxies.com:8080", "username": "username", "password": "password" } } } ``` ### **Free Proxies** **⚠️ Not recommended for production use** #### **Risks** - ❌ Unreliable connections - ❌ Potential security issues - ❌ Often blocked by services - ❌ Poor performance --- ## πŸ” Authentication Methods ### **Username/Password (Most Common)** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "username": "your-username", "password": "your-password" } } } ``` ### **IP Whitelisting** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "username": "", "password": "" } } } ``` **Setup Steps:** 1. Contact proxy provider 2. Provide your server's IP address 3. Configure whitelist in provider dashboard 4. Remove credentials from config ### **Session-Based Authentication** ```json { "browser": { "proxy": { "enabled": true, "server": "session-proxy.example.com:8080", "username": "customer-session-sticky123", "password": "your-password" } } } ``` --- ## 🚫 Bypass Configuration ### **Local Development** **Bypass proxy for local services** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "bypass": [ "localhost", "127.0.0.1", "*.local", "*.internal" ] } } } ``` ### **Specific Domains** **Route certain domains directly** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "bypass": [ "*.microsoft.com", "login.live.com", "account.microsoft.com" ] } } } ``` ### **Advanced Patterns** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "bypass": [ "*.intranet.*", "192.168.*.*", "10.*.*.*", "" ] } } } ``` --- ## πŸŽ›οΈ Advanced Configurations ### **Per-Account Proxies** **Different proxies for different accounts** ```json { "accounts": [ { "email": "user1@example.com", "password": "password1", "proxy": { "enabled": true, "server": "proxy1.example.com:8080" } }, { "email": "user2@example.com", "password": "password2", "proxy": { "enabled": true, "server": "proxy2.example.com:8080" } } ] } ``` ### **Failover Configuration** **Multiple proxy servers for redundancy** ```json { "browser": { "proxy": { "enabled": true, "servers": [ "primary-proxy.example.com:8080", "backup-proxy.example.com:8080", "emergency-proxy.example.com:8080" ], "username": "user", "password": "pass" } } } ``` ### **Geographic Routing** **Location-specific proxy selection** ```json { "browser": { "proxy": { "enabled": true, "regions": { "us": "us-proxy.example.com:8080", "eu": "eu-proxy.example.com:8080", "asia": "asia-proxy.example.com:8080" }, "defaultRegion": "us" } } } ``` --- ## πŸ”’ Security & Environment Variables ### **Credential Protection** **Secure proxy authentication** **Environment Variables:** ```powershell # Set in environment $env:PROXY_USERNAME="your-username" $env:PROXY_PASSWORD="your-password" ``` **Configuration:** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "username": "${PROXY_USERNAME}", "password": "${PROXY_PASSWORD}" } } } ``` ### **HTTPS Verification** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "verifySSL": true, "rejectUnauthorized": true } } } ``` ### **Connection Encryption** ```json { "browser": { "proxy": { "enabled": true, "server": "https://encrypted-proxy.example.com:8080", "tls": { "enabled": true, "version": "TLSv1.3" } } } } ``` --- ## πŸ§ͺ Testing & Debugging ### **Manual Tests** ```bash # Test proxy connection curl --proxy proxy.example.com:8080 http://httpbin.org/ip # Test with authentication curl --proxy user:pass@proxy.example.com:8080 http://httpbin.org/ip # Test geolocation curl --proxy proxy.example.com:8080 http://ipinfo.io/json ``` ### **Script Debug Mode** ```powershell $env:DEBUG_PROXY=1; npm start ``` ### **Health Check Script** ```bash #!/bin/bash PROXY="proxy.example.com:8080" curl --proxy $PROXY --connect-timeout 10 http://httpbin.org/status/200 echo "Proxy health: $?" ``` --- ## πŸ› οΈ Troubleshooting | Problem | Error | Solution | |---------|-------|----------| | **Connection Failed** | `ECONNREFUSED` | Verify server address/port; check firewall | | **Auth Failed** | `407 Proxy Authentication Required` | Verify username/password; check IP whitelist | | **Timeout** | `Request timeout` | Increase timeout values; try different server | | **SSL Error** | `certificate verify failed` | Disable SSL verification; update certificates | ### **Common Error Messages** #### **Connection Issues** ``` [ERROR] Proxy connection failed: ECONNREFUSED ``` **Solutions:** - βœ… Verify proxy server address and port - βœ… Check proxy server is running - βœ… Confirm firewall allows connections - βœ… Test with different proxy server #### **Authentication Issues** ``` [ERROR] Proxy authentication failed: 407 Proxy Authentication Required ``` **Solutions:** - βœ… Verify username and password - βœ… Check account is active with provider - βœ… Confirm IP is whitelisted (if applicable) - βœ… Try different authentication method #### **Performance Issues** ``` [ERROR] Proxy timeout: Request timeout ``` **Solutions:** - βœ… Increase timeout values - βœ… Check proxy server performance - βœ… Try different proxy server - βœ… Reduce concurrent connections --- ## ⚑ Performance Optimization ### **Connection Settings** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "timeouts": { "connect": 30000, "request": 60000, "idle": 120000 }, "connectionPooling": true, "maxConnections": 10 } } } ``` ### **Compression Settings** ```json { "browser": { "proxy": { "enabled": true, "server": "proxy.example.com:8080", "compression": true, "gzip": true } } } ``` ### **Monitoring Metrics** - **Connection Success Rate** β€” % of successful proxy connections - **Response Time** β€” Average request latency through proxy - **Bandwidth Usage** β€” Data transferred through proxy - **Error Rate** β€” % of failed requests via proxy --- ## 🐳 Container Integration ### **Docker Environment** ```dockerfile # Dockerfile ENV PROXY_ENABLED=true ENV PROXY_SERVER=proxy.example.com:8080 ENV PROXY_USERNAME=user ENV PROXY_PASSWORD=pass ``` ### **Kubernetes ConfigMap** ```yaml apiVersion: v1 kind: ConfigMap metadata: name: rewards-proxy-config data: proxy.json: | { "enabled": true, "server": "proxy.example.com:8080", "username": "user", "password": "pass" } ``` ### **Environment-Specific** ```json { "development": { "proxy": { "enabled": false } }, "staging": { "proxy": { "enabled": true, "server": "staging-proxy.example.com:8080" } }, "production": { "proxy": { "enabled": true, "server": "prod-proxy.example.com:8080" } } } ``` --- ## πŸ“Š Best Practices ### **Proxy Selection** - πŸ† **Residential > Datacenter** β€” Better for avoiding detection - πŸ’° **Paid > Free** β€” Reliability and security - πŸ”„ **Multiple providers** β€” Redundancy and failover - 🌍 **Geographic diversity** β€” Flexibility and compliance ### **Configuration Management** - πŸ”‘ **Environment variables** β€” Secure credential storage - πŸ§ͺ **Test before deploy** β€” Verify configuration works - πŸ“Š **Monitor performance** β€” Track availability and speed - πŸ”„ **Backup configs** β€” Ready failover options ### **Security Guidelines** - πŸ”’ **HTTPS proxies** β€” Encrypted connections when possible - πŸ›‘οΈ **SSL verification** β€” Verify certificates - πŸ”„ **Rotate credentials** β€” Regular password updates - πŸ‘οΈ **Monitor access** β€” Watch for unauthorized usage --- ## βš–οΈ Legal & Compliance ### **Terms of Service** - πŸ“‹ Review Microsoft's Terms of Service - πŸ“„ Understand proxy provider's acceptable use policy - 🌍 Ensure compliance with local regulations - πŸ—ΊοΈ Consider geographic restrictions ### **Data Privacy** - πŸ” Understand data flow through proxy - πŸ“ Review proxy provider's data retention policies - πŸ” Implement additional encryption if needed - πŸ“Š Monitor proxy logs and access ### **Rate Limiting** - ⏱️ Respect Microsoft's rate limits - ⏸️ Implement proper delays between requests - 🚦 Monitor for IP blocking or throttling - πŸ”„ Use proxy rotation to distribute load --- ## πŸ”— Related Guides - **[Getting Started](./getting-started.md)** β€” Initial setup and configuration - **[Security](./security.md)** β€” Privacy and data protection - **[Docker](./docker.md)** β€” Container deployment with proxies - **[Humanization](./humanization.md)** β€” Natural behavior patterns