首页 / 帮助文档 / 反爬系统是怎么识别代理的

反爬系统是怎么识别代理的

How Anti-Bot Systems Detect Proxies

TLS 指纹 · HTTP/2 参数 · IP 信誉 · header 顺序 · 行为节奏 · 代理修不了的部分 · 2026-11-27 更新
TLS fingerprints · HTTP/2 settings · IP reputation · header order · behaviour · what a proxy cannot fix · updated 27 November 2026

多数人以为被封就是“我的 IP 不好”。通常 IP 没问题,是这次请求把自己暴露了——它建立 TLS 连接的方式、header 的顺序,或者它跟前面一万次请求表现一模一样。把这几层拆开看,猜谜就变成了清单。

第一层:网络身份

还没交换任何内容,出口 IP 已经被打分了。系统看 ASN、号段注册信息、是否出现在滥用库、最近有多少不同账号用过它、是机房还是接入网。这就是为什么机房 IP 直接被拒,而住宅 IP 得到的是一个验证挑战而不是封禁——信誉不同,待遇就不同。

出口类型典型信誉常见反应
机房 / IDC低——ASN 自己就写着是托管直接封,或者给一个你过不去的挑战
住宅宽带中——真 ISP,但号段被反复回收验证码、限速,或逐步降级
移动 4G/5G高——与真实手机共享挑战更少;限制通常针对行为,不针对 ASN

第二层:TLS 握手

HTTP 还不存在的时候,客户端就交出了自己支持的加密套件、曲线、扩展以及它们的顺序。这个组合就是指纹(JA3/JA4 及其后续格式)。一个自称 Chrome 120、却拿出 Python 库加密套件的请求是自相矛盾的,而矛盾比任何单项值都更致命。这是 requests.get() 打浏览器专用接口时最常见的死法。

第三层:HTTP/2 与 header 顺序

真实浏览器的 HTTP/2 参数(窗口大小、最大并发流、伪头顺序)有固定模式,header 的顺序和大小写也是稳定的。HTTP/1.1 客户端把 User-Agent 放在 Host 前面、或者不发 Sec-Fetch-*,一眼就是它自己。任何支持 HTTP/2 的栈都可以先用指纹检测页确认这一点,再去怀疑代理。

第四层:Cookie 与状态

第一次请求没有 Cookie 是正常的,第十次还没有就不正常了。反爬系统首次访问时下发一个放行 Cookie,之后期望它回来;把它丢掉的客户端每次都要重新过一遍挑战。这是“浏览器能开、脚本不能开”最常见的原因——浏览器留着 cookie jar,脚本没留。

import requests

s = requests.Session()                       # 整轮共用同一个 cookie jar
s.proxies = {"http": PROXY, "https": PROXY}
s.headers.update({
    "Accept-Language": "en-US,en;q=0.9",
    "Accept-Encoding": "gzip, deflate, br",
})
s.get("https://target-site/")                 # 拿到放行 cookie
r = s.get("https://target-site/data")         # 带上去用
print(r.status_code)

第五层:行为

前四层都一致之后,剩下的就是你在做什么。单个出口的请求频率、访问路径顺序、有没有加载过 CSS 和图片、翻页有多快、是不是在完美循环同一个路径——全部可观测。一个移动 IP 每分钟发 5000 个请求,不管 ASN 多漂亮,都不像一台手机。

实用规则:把请求摊到多个出口,让单个出口的节奏接近这条连接上真实用户会产生的量。移动代理天然逼你这么做,因为每个会话就是一台手机——所以移动比一大块机房 IP 宽容得多。

各家侧重什么

系统最看重的地方实际后果
CloudflareTLS / HTTP2 指纹、JS 挑战、按套餐的管理规则浏览器形状的客户端比一堆聪明 header 更容易过
Akamai行为与设备信号、Bot Manager 分类会话一致性和合理导航比单看 IP 更重要
DataDome实时设备与行为评分同一个出口上快速重复请求会迅速升级
PerimeterX / HUMANJS 探针载荷与完整性校验未打补丁的无头浏览器在探针层就被识别

厂商一直在更新,所以这张表应该当重点地图看,不要当规范看。在任何目标上,最重要的一层永远是你还没控制住的那一层。

代理能修什么、不能修什么

问题换更好的代理有用吗真正解决它的办法
机房 ASN 被封有用换成住宅或移动出口
号段信誉掉下来部分有用轮换出口;只在必要时用粘性
TLS 指纹不对没用换成模拟浏览器的客户端,或者直接上真浏览器
header 自相矛盾没用让 header 与声称的客户端一致
cookie jar 丢了没用用持久化会话对象
请求频率太高部分有用降速并分散——多出口有用,控节奏更有用
必须执行 JS 挑战部分有用真浏览器,或用服务端处理的解锁 API

规律很清楚:代理解决的是身份。客户端关于自己说的一切、以及它做的一切,都得你自己管。这也正是解锁 API 存在的原因——把客户端那几层从你手里拿走,只还给你能解析的 HTML。

常见问题

为什么同一个代理,浏览器能开、Python 打不开?

几乎都是客户端问题:TLS 指纹不同、缺放行 cookie、header 与声称的浏览器矛盾。用指纹检测页把两边请求对比一遍就知道。

住宅一定比机房好吗?

对反爬严格的消费类站点,多数情况是。对不评判网络的站点的批量采集,机房更便宜更快——多花住宅的钱不会带来任何好处。

必须上无头浏览器才能过挑战吗?

只有需要执行 JS 的时候才必须。很多目标在 TLS 和 header 层就决定了结果,能模拟浏览器的 HTTP 客户端就够,单页成本低得多。

光靠轮换 IP 能不被封吗?

不能。轮换解决的是信誉和单出口限速。如果指纹和行为一直不变,轮换只是把同一个可识别的模式摊到更多地址上。

住宅 $1.20/GB 起、移动 $2.00/GB 起,解决的是身份。其余在客户端。

看价格

Most people assume a block means "my IP is bad". Usually the IP is fine and the block came from something the request said about itself — the way it opened the TLS connection, the order of its headers, or the fact that it behaved identically to ten thousand requests before it. Understanding the layers is what turns a guessing game into a checklist.

Layer 1: the network identity

The exit IP is scored before any content is exchanged. Systems look at the ASN, the registration of the range, whether the range has appeared in abuse feeds, how many distinct accounts recently used it, and whether it is a hosting provider or an access network. This is why a datacenter IP is rejected outright while a residential one gets a challenge instead of a block — different reputation, different treatment.

Exit typeTypical reputationUsual response
Datacenter / IDCLow — ASN announces itself as hostingImmediate block, or a challenge you cannot pass
Residential broadbandMedium — real ISP, but ranges get recycledChallenge, rate limit, or gradual degradation
Mobile carrier 4G/5GHigh — shared with real handsetsFewer challenges; limits usually apply to behaviour, not to the ASN

Layer 2: the TLS handshake

Before HTTP exists, the client offers a list of ciphers, curves, extensions and their order. That offering is a fingerprint (JA3/JA4 and the newer formats). A request claiming to be Chrome 120 but offering the cipher suite of a Python library is inconsistent, and inconsistency is a stronger signal than any single value. This is the layer that trips most scripts writing requests.get() against a browser-only endpoint.

Layer 3: HTTP/2 and header order

Real browsers set HTTP/2 settings (window size, max concurrent streams, pseudo-header order) in a specific pattern, and send headers in a stable order with the expected casing. HTTP/1.1 clients that send User-Agent before Host, or omit Sec-Fetch-*, look like what they are. Any HTTP/2-aware stack lets you observe this with a fingerprint check page before you blame the proxy.

Layer 4: cookies and state

A first request with no cookies is normal. The tenth request with no cookies is not. Anti-bot systems set a clearance cookie on the first visit and then expect it back; a client that drops it re-earns a challenge every time. This is the most common cause of "the proxy works in the browser but not in my script" — the browser kept the cookie jar, the script did not.

import requests

s = requests.Session()                       # one cookie jar for the whole run
s.proxies = {"http": PROXY, "https": PROXY}
s.headers.update({
    "Accept-Language": "en-US,en;q=0.9",
    "Accept-Encoding": "gzip, deflate, br",
})
s.get("https://target-site/")                 # earns the clearance cookie
r = s.get("https://target-site/data")         # reuses it
print(r.status_code)

Layer 5: behaviour

If the first four layers are consistent, what remains is what you do. Request rate per exit, navigation order, whether you ever load CSS or images, how fast you move between pages, whether the same path is hit in a perfect loop — all of it is observable. A single mobile IP making 5,000 requests per minute is not behaving like a phone, whatever its ASN says.

Practical rule: distribute across exits at roughly the rate a real user of that connection would generate. Mobile forces this on you because each session is a physical handset — which is why mobile is more forgiving than a large datacenter block.

What each vendor emphasises

SystemWhere it leans hardestPractical consequence
CloudflareTLS/HTTP2 fingerprints, JS challenges, managed rules per planA browser-shaped client passes more often than a clever header set
AkamaiBehavioural and device signals, Bot Manager categoriesSession consistency and realistic navigation matter more than IP alone
DataDomeReal-time device and behavioural scoringRapid identical requests across one exit escalate quickly
PerimeterX / HUMANJS sensor payloads and integrity checksHeadless browsers without patching are detected at the sensor level

Vendors update continuously, so treat this table as a map of priorities rather than a specification. The layer that matters most on any given target is the one you have not controlled yet.

What a proxy can and cannot fix

ProblemA better proxy helps?What actually fixes it
Datacenter ASN blockedYesMove to residential or mobile exits
Range reputation degradedPartlyRotate exits; use sticky sessions only where needed
Broken TLS fingerprintNoBrowser-mimicking client, or a real browser
Header contradictionsNoMatch headers to the claimed client
Cookie jar droppedNoPersistent session object
Request rate too highPartlySlow down and distribute — more exits help, pacing helps more
JS challenge that must executePartlyReal browser, or an unlock API that handles it server-side

The pattern: proxies solve identity. Everything a client says about itself, and everything it does, is yours to fix. That is also why an unlock API exists — it takes the client-side layers off your plate and returns HTML you can parse.

Frequently asked questions

Why does a page work in my browser but fail in Python through the same proxy?

Almost always the client, not the proxy: a different TLS fingerprint, missing clearance cookies, or header values that contradict the claimed browser. Compare both requests with a fingerprint check page.

Is residential always better than datacenter?

For anti-bot-protected consumer sites, mostly yes. For high-volume scraping of sites that do not score the network, datacenter is cheaper and faster — paying for residential adds nothing.

Do I need a headless browser to pass challenges?

Only where JavaScript must execute. Many targets are decided at the TLS and header layer, where a browser-mimicking HTTP client is enough and far cheaper per page.

Can rotating IPs alone stop me getting blocked?

No. Rotation fixes reputation and per-exit rate limits. If the fingerprint and behaviour stay constant, rotation just spreads the same detectable pattern across more addresses.

Residential from $1.20/GB and mobile from $2.00/GB fix identity. The rest is your client.

See pricing

更多文档 IPLight 帮助文档中心 · 开发者文档 · support@iplight.net · 返回官网