fix(proxy): Use rotating IPs instead of sticky sessions
Removes session parameter from Evomi proxy URL so each request gets a different IP. Prevents all workers from sharing same IP. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1035,7 +1035,7 @@ export function getEvomiConfig(): EvomiConfig {
|
|||||||
* Build a geo-targeted Evomi proxy URL
|
* Build a geo-targeted Evomi proxy URL
|
||||||
*
|
*
|
||||||
* @param stateCode - US state code (e.g., 'AZ')
|
* @param stateCode - US state code (e.g., 'AZ')
|
||||||
* @param workerId - Worker ID for session stickiness
|
* @param workerId - Worker ID (ignored - using rotating IPs)
|
||||||
* @param city - Optional city name (lowercase, dots for spaces)
|
* @param city - Optional city name (lowercase, dots for spaces)
|
||||||
* @returns Proxy URL or null if Evomi not configured
|
* @returns Proxy URL or null if Evomi not configured
|
||||||
*/
|
*/
|
||||||
@@ -1056,14 +1056,6 @@ export function buildEvomiProxyUrl(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the passed session ID directly (from identity pool) or generate from worker ID
|
|
||||||
// Identity pool passes unique session IDs like "scrapc-1702...-abc123"
|
|
||||||
// Regular callers pass worker IDs - we add region suffix for stickiness
|
|
||||||
const isIdentitySession = sessionOrWorkerId.includes('-') && sessionOrWorkerId.length > 20;
|
|
||||||
const sessionId = isIdentitySession
|
|
||||||
? sessionOrWorkerId.replace(/[^a-zA-Z0-9]/g, '').slice(0, 20) // Use identity session (max 20 chars)
|
|
||||||
: `${sessionOrWorkerId.replace(/[^a-zA-Z0-9]/g, '').slice(0, 6)}${region.slice(0, 4)}`; // Worker ID + region
|
|
||||||
|
|
||||||
// Build geo target string
|
// Build geo target string
|
||||||
let geoParams = `_country-US_region-${region}`;
|
let geoParams = `_country-US_region-${region}`;
|
||||||
let geoDisplay = region;
|
let geoDisplay = region;
|
||||||
@@ -1073,9 +1065,8 @@ export function buildEvomiProxyUrl(
|
|||||||
geoDisplay = `${city}, ${region}`;
|
geoDisplay = `${city}, ${region}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build full proxy URL
|
// Build full proxy URL - rotating (no session = new IP each request)
|
||||||
// Format: http://user:pass_geo_session@host:port
|
const url = `http://${config.user}:${config.pass}${geoParams}@${config.host}:${config.port}`;
|
||||||
const url = `http://${config.user}:${config.pass}${geoParams}_session-${sessionId}_lifetime-${config.sessionLifetimeMinutes}@${config.host}:${config.port}`;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url,
|
url,
|
||||||
|
|||||||
Reference in New Issue
Block a user