Proxies for Geo Testing
Geo-targeting bugs are invisible from your development machine. A pricing page showing USD to users in Japan, a redirect loop for European visitors, a CDN misconfiguration serving the wrong language — these issues only surface when you can test from the affected locations. Proxy infrastructure lets you simulate requests from any country without leaving your desk.
Common Geo-Testing Scenarios
| Scenario | What to Test | Critical For |
|---|---|---|
| Regional pricing | Currency, tax, price display | E-commerce |
| Content localization | Language, imagery, layout | Multinational sites |
| Geo-redirects | URL routing by country | International SEO |
| CDN behavior | Cache headers, edge selection | Performance |
| Compliance | Cookie consent, data handling | Legal/GDPR |
| Ad targeting | Ad content, placement | Marketing |
Python Geo-Testing Framework
from dataclasses import dataclass
import httpx
@dataclass(frozen=True)
class GeoTestResult:
country: str
url: str
status: int
final_url: str
content_language: str
currency_detected: str
response_time_ms: float
def build_proxy_url(username: str, password: str, country: str) -> str:
return f"http://{username}-country-{country.lower()}:{password}@gate.hexproxies.com:8080"
def run_geo_test(
url: str,
country: str,
username: str,
password: str,
) -> GeoTestResult:
"""Test a URL from a specific country's perspective."""
import time
proxy = build_proxy_url(username, password, country)
start = time.monotonic()
with httpx.Client(proxy=proxy, follow_redirects=True, timeout=30) as client:
resp = client.get(url)
elapsed = (time.monotonic() - start) * 1000
content = resp.text.lower()
# Detect currency symbols
currency = "unknown"
for symbol, code in [("quot;, "USD"), ("€", "EUR"), ("£", "GBP"), ("¥", "JPY"), ("₹", "INR")]:
if symbol in content:
currency = code
break
return GeoTestResult(
country=country,
url=url,
status=resp.status_code,
final_url=str(resp.url),
content_language=resp.headers.get("content-language", "not set"),
currency_detected=currency,
response_time_ms=round(elapsed, 1),
)
# Test from multiple countries
COUNTRIES = ["US", "GB", "DE", "JP", "BR", "AU", "IN", "FR"]
results = [run_geo_test("https://yoursite.com/pricing", c, "YOUR_USER", "YOUR_PASS") for c in COUNTRIES]
for r in results:
print(f"{r.country}: status={r.status}, currency={r.currency_detected}, redirected_to={r.final_url}")Node.js Geo-Testing
const { HttpsProxyAgent } = require('https-proxy-agent');
async function geoTest(url, country, username, password) {
const proxyUrl = `http://${username}-country-${country.toLowerCase()}:${password}@gate.hexproxies.com:8080`;
const agent = new HttpsProxyAgent(proxyUrl);
const start = Date.now();
const response = await fetch(url, {
agent,
redirect: 'follow',
headers: { 'Accept-Language': 'en-US,en;q=0.9' },
});
const body = await response.text();
const elapsed = Date.now() - start;
return {
country,
status: response.status,
finalUrl: response.url,
bodyLength: body.length,
responseTimeMs: elapsed,
};
}
const countries = ['US', 'GB', 'DE', 'JP', 'BR', 'AU'];
const results = await Promise.all(
countries.map(c => geoTest('https://yoursite.com', c, 'YOUR_USER', 'YOUR_PASS'))
);
console.table(results);Automated Geo-Testing in CI/CD
Integrate geo-tests into your CI pipeline to catch localization regressions before deployment:
def assert_geo_redirect(url: str, country: str, expected_redirect: str, username: str, password: str) -> bool:
result = run_geo_test(url, country, username, password)
if expected_redirect not in result.final_url:
raise AssertionError(
f"Expected {country} redirect to contain '{expected_redirect}', "
f"got '{result.final_url}'"
)
return True
# CI assertions
assert_geo_redirect("https://yoursite.com", "DE", "/de/", "YOUR_USER", "YOUR_PASS")
assert_geo_redirect("https://yoursite.com", "JP", "/ja/", "YOUR_USER", "YOUR_PASS")
assert_geo_redirect("https://yoursite.com", "BR", "/pt/", "YOUR_USER", "YOUR_PASS")Testing CDN Geo-Behavior
Verify your CDN serves content from the correct edge location and respects geo-based caching rules. Check response headers like CF-Ray, X-Cache, and X-Served-By from different geographic proxies to confirm proper CDN routing.
Hex Proxies' residential network covers 195+ countries, giving you comprehensive geographic coverage for testing any localization or geo-targeting implementation.