AI Tools Compared

GitHub Copilot has become an essential tool for developers, but corporate network environments often block or interfere with its functionality. If you have ever encountered the frustrating “Copilot is not available” message while working behind a corporate proxy or firewall, this guide provides practical solutions to get you back to coding with AI assistance.

Understanding the Problem

GitHub Copilot communicates with OpenAI’s servers (and Microsoft Azure endpoints for enterprise users) through HTTPS connections. Corporate proxies and firewalls inspect, filter, and sometimes block these connections. The result is Copilot failing to load, returning authentication errors, or showing “Copilot could not connect to the server” notifications.

The issue typically manifests in several ways:

Diagnosing Your Network Configuration

Before applying fixes, identify whether a proxy or firewall is causing the issue. Open your terminal and test connectivity to Copilot’s endpoints:

# Test connection to Copilot API
curl -v https://api.github.com/copilot

# Test connection to GitHub's AI API
curl -v https://api.github.com/orgs/{org}/copilot/billing

If these commands fail or timeout, your network is likely blocking or proxying traffic in a way that breaks Copilot. Check your system proxy settings:

# macOS - Check system proxy settings
scutil --proxy

# Linux - Check environment variables
echo $HTTP_PROXY
echo $HTTPS_PROXY
echo $NO_PROXY

Solution 1: Configure VS Code Proxy Settings

Visual Studio Code and its extensions respect the system’s proxy settings, but you may need to explicitly configure them for Copilot to work properly.

Add these settings to your VS Code settings.json:

{
  "http.proxy": "http://your-proxy-server:8080",
  "http.proxyStrictSSL": false,
  "http.proxySupport": "on",
  "github.copilot.advanced": {
    "network": {
      "useProxy": true,
      "proxyStrictSSL": false
    }
  }
}

Replace http://your-proxy-server:8080 with your actual corporate proxy address. If your proxy requires authentication, use:

{
  "http.proxy": "http://username:password@your-proxy-server:8080"
}

Solution 2: Set Environment Variables

For command-line tools and IDEs that do not have built-in proxy configuration, set environment variables. Add these to your shell profile (~/.bashrc, ~/.zshrc, or ~/.profile):

# HTTP and HTTPS proxy settings
export HTTP_PROXY="http://your-proxy-server:8080"
export HTTPS_PROXY="http://your-proxy-server:8080"

# No proxy for local addresses
export NO_PROXY="localhost,127.0.0.1,.local,github.com,api.github.com"

# Alternative lowercase versions (some tools use these)
export http_proxy="http://your-proxy-server:8080"
export https_proxy="http://your-proxy-server:8080"
export no_proxy="localhost,127.0.0.1,.local,github.com,api.github.com"

Apply the changes:

source ~/.zshrc  # or source ~/.bashrc

Solution 3: Configure Git to Use Proxy

Git operations often trigger Copilot authentication checks. Ensure Git uses your proxy:

# Set proxy for HTTPS connections
git config --global http.proxy http://your-proxy-server:8080

# Verify the configuration
git config --global --get http.proxy

# If you need authentication
git config --global http.proxy http://username:password@proxy-server:port

For NTLM-based corporate proxies (common in Windows environments), consider using cntlm or ntlmaps as a local proxy helper:

# Install cntlm on macOS
brew install cntlm

# Configure cntlm in /usr/local/etc/cntlm.conf
# Then set Git to use localhost:3128
git config --global http.proxy http://localhost:3128

Solution 4: Whitelist Copilot Endpoints

If you have network administrator access, configure your firewall or proxy to allow traffic to Copilot’s required endpoints:

Required domains:

IP ranges (Azure): Allow traffic to Microsoft’s Azure IP ranges where Copilot instances may be hosted.

In a corporate proxy configuration (Squid example):

# Squid proxy ACL configuration
acl copilot_domains dstdomain .github.com .visualstudio.com .azure.com
http_access allow copilot_domains

Solution 5: Use a SOCKS5 Proxy

Some corporate firewalls inspect HTTPS traffic deeply, breaking end-to-end encryption that Copilot requires. A SOCKS5 proxy can bypass this inspection:

# Set up SOCKS5 proxy in environment
export SOCKS_PROXY="socks5://your-socks-proxy:1080"
export SOCKS5_PROXY="socks5://your-socks-proxy:1080"

# Configure Git to use SOCKS5
git config --global http.proxy socks5://your-socks-proxy:1080

VS Code does not natively support SOCKS5 proxies. Use tools like proxychains to wrap the VS Code process:

# Install proxychains
brew install proxychains4

# Run VS Code through proxy
proxychains4 code

Solution 6: Check Certificate Issues

Corporate proxies often perform SSL inspection, replacing server certificates with their own. This breaks Copilot’s connection validation. Two options exist:

Option A: Disable SSL inspection (requires admin access)

Work with your IT department to exclude Copilot endpoints from SSL inspection.

Option B: Install corporate certificate

If your organization uses a custom CA certificate:

# macOS - Add certificate to system keychain
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corporate-proxy-ca.crt

# Linux - Add to CA certificates
sudo cp corporate-proxy-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

Solution 7: Use GitHub Copilot Business or Enterprise

Organizations with GitHub Copilot Business or Enterprise can use Microsoft’s Azure backbone, which often has better proxy compatibility. These plans provide:

Contact your GitHub administrator to verify your organization’s Copilot plan and configuration options.

Quick Troubleshooting Checklist

When Copilot fails behind a corporate proxy, work through this checklist:

  1. Verify internet connectivity — Can you access github.com in your browser?
  2. Check proxy environment variables — Are HTTP_PROXY and HTTPS_PROXY set?
  3. Test API endpoints — Does curl api.github.com succeed?
  4. Restart your IDE — Sometimes proxy changes require a full restart
  5. Check Copilot subscription status — Ensure your license is active
  6. Review extension logs — VS Code: Help > Toggle Developer Tools > Console

Advanced Proxy Debugging

Detailed Network Trace

# Verbose curl test with all headers
curl -v -x http://your-proxy:8080 \
  -H "Authorization: token your-github-token" \
  https://api.github.com/user

# Monitor actual traffic
tcpdump -i any -n "tcp port 443 or tcp port 8080" | head -50

# Test with strace (Linux)
strace -e trace=network curl api.github.com

Proxy Authentication Testing

If your proxy requires authentication:

# Test basic auth
curl -v -x http://username:password@proxy:8080 https://api.github.com

# Test NTLM auth (Windows)
# Use cntlm to bridge NTLM -> HTTP
curl -x http://localhost:3128 https://api.github.com

TLS/SSL Certificate Issues

When proxy performs SSL inspection:

# Check certificate chain
openssl s_client -connect api.github.com:443 -showcerts

# If corporate CA is involved, extract it
openssl s_client -connect api.github.com:443 -showcerts | \
  sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > corp-ca.crt

# Add to system CA store (macOS)
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-ca.crt

Enterprise Environment Configurations

Example: Squid Proxy Setup

If you manage your proxy:

# /etc/squid/squid.conf
acl github dstdomain api.github.com copilot.github.com
acl ssl_ports port 443
acl safe_ports port 80 443 8080

http_access allow github
http_access deny !safe_ports
http_access deny CONNECT !ssl_ports

# Forward to upstream corporate proxy
cache_peer upstream.corp.proxy parent 8080 0 name=upstream
cache_peer_access upstream allow all

# SSL bump for inspection (optional)
https_port 3128 cert=/path/to/cert.pem key=/path/to/key.pem

Windows Group Policy Configuration

For enterprise Windows administrators:

# Configure via Group Policy for multiple machines
# Use Preferences > Windows Settings > Network > Proxy Settings

# Or via PowerShell for individual machines
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyServer -Value "proxy.corp:8080"

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyEnable -Value 1

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyOverride -Value "*.local;<local>"

Performance Optimization Through Proxy

Proxies add latency. Minimize impact:

{
  "http.proxy": "http://proxy.corp:8080",
  "http.proxyAuthorization": "basic",
  "http.proxyStrictSSL": false,
  "http.timeout": 30000,
  "http.keepAliveTimeout": 5000,
  "github.copilot.requestTimeout": 15000
}

These settings:

Caching Strategy Behind Proxy

Reduce API calls with smart caching:

// VS Code extension caching
const cache = new Map();
const CACHE_TTL = 3600000; // 1 hour

async function getCachedCompletion(prompt) {
  const cacheKey = prompt.substring(0, 100);

  if (cache.has(cacheKey)) {
    const cached = cache.get(cacheKey);
    if (Date.now() - cached.timestamp < CACHE_TTL) {
      return cached.data;
    }
  }

  const result = await getCompletionFromCopilot(prompt);
  cache.set(cacheKey, {
    data: result,
    timestamp: Date.now()
  });

  return result;
}

Monitoring and Logging

Create Copilot Connection Monitor

import requests
import time
from datetime import datetime
import json

class CopilotProxyMonitor:
    def __init__(self, proxy_url: str, log_file: str = "copilot_connections.log"):
        self.proxy_url = proxy_url
        self.log_file = log_file
        self.session = requests.Session()
        self.session.proxies = {
            'http': proxy_url,
            'https': proxy_url
        }

    def test_connectivity(self) -> dict:
        """Test Copilot connectivity through proxy"""
        endpoints = [
            'https://api.github.com/user',
            'https://copilot.github.com/api/status',
            'https://origin-authentication.webapi.visualstudio.com'
        ]

        results = {}
        for endpoint in endpoints:
            try:
                start = time.time()
                response = self.session.get(endpoint, timeout=5)
                duration = time.time() - start

                results[endpoint] = {
                    'status': response.status_code,
                    'latency_ms': duration * 1000,
                    'success': response.status_code < 400
                }
            except Exception as e:
                results[endpoint] = {
                    'status': 'error',
                    'error': str(e),
                    'success': False
                }

        self._log_results(results)
        return results

    def _log_results(self, results: dict):
        """Log test results to file"""
        with open(self.log_file, 'a') as f:
            entry = {
                'timestamp': datetime.now().isoformat(),
                'results': results
            }
            f.write(json.dumps(entry) + '\n')

# Usage
monitor = CopilotProxyMonitor('http://proxy.corp:8080')
monitor.test_connectivity()

Run this periodically to track proxy-related issues:

# Check connectivity every hour
while true; do
  python monitor.py
  sleep 3600
done

Emergency Workarounds

When proxy issues can’t be fixed immediately:

Option 1: Mobile Hotspot Bypass

Use your phone’s hotspot to bypass corporate proxy temporarily. Not recommended for sensitive code, but useful for troubleshooting.

Option 2: SSH Tunnel Through Jump Host

# If you have access to a machine outside the proxy:
ssh -D 1080 user@external-server.com

# Then use SOCKS5 in Copilot
export SOCKS_PROXY="socks5://localhost:1080"

Option 3: VPN (with IT approval)

Work with your IT team to authorize a company VPN that doesn’t restrict Copilot access. Some corporate VPNs have better Copilot compatibility than others.

Long-term Solutions

Request Copilot as Approved Tool

Document the business value and work with IT to officially approve Copilot:

  1. Show ROI: Developer productivity gains (typically 20-40%)
  2. Security: GitHub Copilot doesn’t store code
  3. Precedent: List other approved tools using similar endpoints
  4. Workaround cost: Show IT the cost of manual workarounds

Provide IT with:

Upgrade to GitHub Copilot Enterprise

GitHub Copilot Business/Enterprise has better enterprise proxy support:

{
  "github.copilot.advanced": {
    "authentication": "enterprise",
    "enterpriseProxy": "http://proxy.corp:8080"
  }
}

Enterprise plans include:

Post-Mortem: Preventing Future Proxy Issues

After resolving proxy issues:

  1. Document your configuration - Save your working proxy settings in team wiki
  2. Test during onboarding - New team members test Copilot on day 1
  3. Monitor continuously - Use the monitoring script above
  4. Plan for changes - When IT updates proxy settings, test Copilot first

Create a team runbook:

# Copilot Behind Corporate Proxy - Team Runbook

## If Copilot stops working:

1. Run: `curl -x http://proxy.corp:8080 https://api.github.com`
2. If that fails, it's a network issue - contact IT
3. If it works, restart VS Code
4. If still broken, check ~/.vscode/settings.json for proxy config

## Network info:
- Proxy: proxy.corp:8080
- Auth: Use Windows credentials
- Bypass: localhost,127.0.0.1,.local

## Contact: IT Service Desk #2525