Opt-In Software Blog

Software, dvelopment, and practical insights

Making Any Scraper Work with Sticky Proxies

Read in: English | Русский

Many modern proxy providers sell so-called sticky proxies (also known as session-based proxies). This is a very popular solution for scraping, automation, data collection, and working around anti-bot protections.

What is a sticky proxy?

A sticky proxy is a proxy server that “locks” one IP address to you for a certain amount of time (for example, 5 or 10 minutes) using a session. Usually, the session is defined via the username, for example:

user-session-ABC123-sessTime-10:password@proxy_host:proxy_port

While the session is active, you will access the internet from the same IP address. When the time expires or you change the session ID, you get a new IP.

Today, most large proxy providers (residential, mobile, ISP) work exactly this way: you connect to a single host and port, and IP rotation is controlled via parameters in the username.

Not all software supports sticky proxies

Many applications (scraping software, old parsers, bots, automation tools):

  • cannot work with proxies that require authentication
  • cannot manage sessions
  • expect just a list of IP:PORT, without username and password

Because of this, they cannot be directly connected to modern sticky proxy providers.

Map local TCP ports through sticky proxies

The idea is very simple:

  • We run a local service
  • It opens a range of local ports
  • Each local port:
    • automatically connects to the sticky proxy
    • uses its own separate session
  • As a result:
    • 127.0.0.1:5001 → sticky proxy session AAA1
    • 127.0.0.1:5002 → sticky proxy session AAA2
    • 127.0.0.1:5003 → sticky proxy session AAA3
    • and so on

And your software just works with regular proxies without authentication:

127.0.0.1:5001
127.0.0.1:5002
127.0.0.1:5003

ProxyMapService

The Proxy Map Service listens for incoming TCP connections on one or more ports and redirects traffic to an external proxy server defined in the configuration (appsettings.json).

It can:

  • map port ranges
  • automatically manage sticky sessions
  • work with HTTP / SOCKS proxies
  • modify / generate username parameters

Configuration example

Here is an example config:

"ProxyMappings": [
  {
    "Listen": {
      "PortRange": {
        "Start": 10001,
        "End": 10100
      },
      "RejectHttpProxy": false,
      "StickyProxyLifetime": 10
    },
    "Authentication": {
      "Required": false,
      "Verify": false,
      "SetAuthentication": false,
      "RemoveAuthentication": false
    },
    "ProxyServers": {
      "Items": [
        {
          "Host": "PROXY_IP",
          "Port": PROXY_PORT,
          "ProxyType": "Http",
          "Username": "USERNAME",
          "Password": "PASSWORD",
          "UsernameParameters": [
            {
              "Name": "zone",
              "Value": "custom"
            },
            {
              "Name": "region",
              "Value": "US"
            },
            {
              "Name": "session",
              "Value": "^[A-Za-z]{8}",
              "SessionId": true
            },
            {
              "Name": "sessTime",
              "Value": "$sessTime",
              "Default": "10",
              "SessionTime": true
            }
          ]
        }
      ]
    }
  }
]

In this example you need to replace:

  • PROXY_IP
  • PROXY_PORT
  • USERNAME
  • PASSWORD

with the values provided by your proxy provider.

How does it work in practice?

  • ProxyMapService opens local ports 10001–10100

  • Each port:

    • automatically generates a new sticky session
    • keeps it for StickyProxyLifetime = 10 minutes
  • You just set in your software:

127.0.0.1:10001
127.0.0.1:10002
127.0.0.1:10003

Search