Why the User-Agent proves nothing

A User-Agent header is a string the client writes. There is no signature, no key, no handshake. A scraper that wants your catalogue sets User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) and moves on to the next request. The header is a claim, and claims are free.

What is not free is an IP address inside Google's own netblocks, and a reverse DNS name that resolves back to that address. Those cost money and require control of the network. That asymmetry is the whole basis of bot verification.

The rule

Never grant a crawler special treatment because of its User-Agent. Grant it because the address is in the operator's published range, or because reverse DNS resolves forward to it — ideally both.

Step 1 — reverse DNS

Take an address out of your access log and ask DNS what name it has. Google's crawlers live under googlebot.com and google.com.

$ dig +short -x 66.249.66.1
crawl-66-249-66-1.googlebot.com.

A name like that is a good sign, but on its own it proves nothing at all. Reverse zones are delegated to whoever owns the netblock, so an attacker who rents a small block from a hosting provider can point the PTR record at crawl-66-249-66-1.googlebot.com — the string is just text in their own zone file. This is the single most common way "verified Googlebot" filters get bypassed.

Step 2 — forward confirmation

Now resolve that name forward and check whether it returns the address you started with.

$ dig +short crawl-66-249-66-1.googlebot.com
66.249.66.1

That is the check. The name can only resolve back to the address if Google controls both the forward zone and the netblock. A forged PTR fails here, because the attacker cannot publish records inside googlebot.com.

The same pattern holds for the other engines that publish a naming convention:

CrawlerReverse DNS must end with
Googlebot, AdsBot, Google-InspectionToolgooglebot.com or google.com
Bingbotsearch.msn.com
Applebotapplebot.apple.com
YandexBotyandex.com, yandex.ru or yandex.net

A forward-confirmed name outside the expected suffix is suspicious but not conclusive — Google has moved crawler naming around before. A forward-confirmed name inside the suffix is conclusive. A PTR that fails forward confirmation is a forgery, always.

Step 3 — the published range

Since 2020 Google has published the exact prefixes its crawlers use, as a JSON file updated several times a week:

$ curl -s https://developers.google.com/static/search/apis/ipranges/googlebot.json | head -c 220
{
    "creationTime": "2026-11-27T15:45:56.000000",
    "prefixes": [
        {
            "ipv6Prefix": "2001:4860:4801:10::/64"
        },
        {
            "ipv4Prefix": "66.249.64.0/27"
        },

The list is split into four files, and mixing them up is a common source of false alarms:

  • googlebot.json — the main Search crawler, Googlebot-Image, Googlebot-News, Googlebot-Video.
  • special-crawlers.json — AdsBot, Storebot, Google-InspectionTool and feed fetchers. Different job, same company.
  • user-triggered-fetchers.json — fetches caused by a person (link previews, page rendering in a tool).
  • user-triggered-fetchers-google.json — Google's own hosted preview fetchers.

Note the granularity: modern Googlebot entries are often /27, not the /19 people remember. A hand-written rule like 66.249.64.0/19 still works because it is a superset, but a rule copied from a blog post in 2019 may include addresses Google no longer uses. Always resolve against the current file rather than a remembered CIDR.

The proxy trap that fakes a false negative

The most common reason a genuine Googlebot "fails" verification is that you are not looking at Googlebot's address at all. If Cloudflare, Fastly, a load balancer or an nginx reverse proxy sits in front of your application, the socket peer is the proxy — and the real client is in a header.

In nginx, make the real client address explicit and log it:

# /etc/nginx/conf.d/realip.conf
# Trust Cloudflare only if you actually sit behind it.
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
# ...the rest of the Cloudflare ranges, or use ngx_http_realip with a dynamic list
real_ip_header CF-Connecting-IP;

log_format verified '$remote_addr - $http_user_agent [$time_local] '
                    '"$request" $status $body_bytes_sent';

If you control the proxy yourself, prefer X-Real-IP set from $remote_addr on the edge and never trust a value that arrives from the client. A header a client can choose is no better than a User-Agent a client can choose.

Check before you block

If your verifier says a "Googlebot" address is fake but every one of them comes from a single hosting provider, look for a proxy or a MITM appliance before you write a deny rule. Blocking your own CDN is a memorable mistake.

Reading the three results together

Range matchPTRForward-confirmedVerdict
yesany—Real. The operator's own feed vouches for the address.
no*.googlebot.comyesReal. FCrDNS passes; the feed may lag a new netblock.
no*.googlebot.comnoForged. The PTR name points at a different address or nowhere.
nonone or unrelated—Spoofed. A string in a header and nothing else.

Only the first two rows earn an allow rule. Everything else should hit the same path as an anonymous client: rate limits, no crawl budget, no exceptions.

Running the check automatically

Do not hand-verify addresses. Feed the day's top talkers to the verifier and keep a decision log:

#!/usr/bin/env bash
# top-bots.sh — verify the 20 busiest non-browser addresses from yesterday
set -euo pipefail
LOG=/var/log/nginx/access.log

awk '{print $1}' "$LOG" \
  | sort | uniq -c | sort -rn | head -20 | awk '{print $2}' \
  | while read -r ip; do
      ua=$(grep -m1 -F " $ip " "$LOG" | sed -E 's/.*"([^"]*)"$/\1/' || true)
      printf '%s ' "$ip"
      curl -s https://checkip.space/api/verify-bot \
        -H 'content-type: application/json' \
        -d "{\"ip\":\"$ip\",\"userAgent\":\"$ua\"}" \
        | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d["label"], "-", d["summary"])'
    done

The bot verifier runs exactly these three checks and returns the reasoning as JSON, so you can put it in a cron job, a fail2ban action or a nightly report. If you would rather keep it inside your own network, the logic is small enough to reimplement: fetch four Google JSON files every few hours, match the address against the prefixes, and run the two DNS queries with a timeout.

One last thing worth knowing: verifying a crawler is not the same as trusting it. A verified Googlebot can still crawl pages you did not intend to expose; a spoofed one can still be harmless. Verification decides who is knocking, not what they may do.