Skip to Content
RelevanBot

RelevanBot

RelevanBot is the web crawler of Relevan. It fetches the pages of a website for a search index that the owner of the website set up in Relevan. It reads only the sitemaps that the owner adds, and it fetches only pages on a domain that the owner verified.

How to identify RelevanBot

RelevanBot sends this user agent string with each request, also when it renders a page that needs JavaScript:

Mozilla/5.0 (compatible; RelevanBot/1.0; +https://docs.relevan.dev/crawler)

The robots.txt token is RelevanBot.

What RelevanBot fetches

  • Only verified domains. A Relevan customer must prove control of a domain before RelevanBot fetches from it. The proof is a DNS TXT record at _relevan-verify.<domain>. A verified domain covers the domain and its subdomains. RelevanBot checks the record again before each sync. When the record is gone, the sync stops and RelevanBot fetches nothing.
  • Only the sitemap and the pages it lists. RelevanBot reads the sitemap (or the sitemap index and its child sitemaps) that the customer added, and fetches the pages that the sitemap lists. It does not follow the links in a page.
  • Only the verified domain. RelevanBot refuses a child sitemap or a redirect that leads to a host outside the verified domain. It fetches only http and https URLs on the default ports.
  • Only changed pages after the first sync. RelevanBot syncs each sitemap about once a day. It fetches a page again only when the page is new or its lastmod in the sitemap changed. A page with no lastmod gets a conditional request (If-None-Match and If-Modified-Since) at most once every 7 days.

How RelevanBot limits its load

  • At most 2 concurrent requests to one host.
  • At least 500 ms between the starts of two requests to one host.
  • It obeys the Crawl-delay of the RelevanBot group in robots.txt, up to 10 seconds.
  • A request times out after 20 seconds.

robots.txt

A sync runs in parts. RelevanBot reads /robots.txt from each host at the start of each part of a sync. It obeys the rules of the User-agent: RelevanBot group. When robots.txt has no group for RelevanBot, it obeys the User-agent: * group. RelevanBot skips a disallowed page and does not index it.

Block RelevanBot

To block RelevanBot from the whole site, add this group to robots.txt:

User-agent: RelevanBot Disallow: /

To block one part of the site:

User-agent: RelevanBot Disallow: /private/

To make RelevanBot slower:

User-agent: RelevanBot Crawl-delay: 5

If you own the domain and set up the crawl yourself, you can also stop it in Relevan: delete the source in the console, or remove the _relevan-verify TXT record. Without the record, the next sync stops before it fetches a page.

Allow RelevanBot through Cloudflare or a WAF

A firewall or a bot filter in front of your site can block RelevanBot. To let it through, allow the requests that carry the crawl token of your source.

RelevanBot sends the crawl token in this header on each HTTPS request to your verified domain: robots.txt, each sitemap, and each page.

X-Relevan-Crawl-Token: <token>
  • Get the token. Relevan shows the token once, when you add the source and when you rotate the token. In the console, open the source and use Copy the token. With the API, read crawlToken.value in the response of POST /v1/{orgId}/indexes/{indexName}/sources or POST /v1/{orgId}/indexes/{indexName}/sources/{sourceId}/crawl-token/rotate.
  • Keep the token secret. Anyone with the token can pass your rule. RelevanBot sends it only over HTTPS, and only to hosts on your verified domain. It does not send the token on a redirect to another host, because it does not follow that redirect.
  • Rotate the token when it leaks. The old token stops at once. Put the new token in your rule, because RelevanBot sends only the new token from its next request.
  • Pages that need JavaScript. RelevanBot renders a page that builds its text with JavaScript in a separate browser service, which does not send the token. Behind a WAF rule that checks the token, such a page is indexed from its HTML as the server sends it.

Cloudflare

Create a custom rule in Security > WAF > Custom rules:

  • Expression (use Edit expression):

    (http.request.headers["x-relevan-crawl-token"][0] eq "<token>")
  • Action: Skip.

  • WAF components to skip: All remaining custom rules, All Super Bot Fight Mode rules, All managed rules, and All rate limiting rules. Under More components to skip, also select Browser Integrity Check and Security Level.

  • Place at: First. A custom rule that runs before this rule can still block RelevanBot, and “All remaining custom rules” skips each custom rule after it, such as a rule that blocks bots.

Cloudflare writes header names in lowercase in the expression. Put the token in place of <token>.

A custom rule cannot skip Bot Fight Mode, the bot filter of the Free plan. On the Free plan, turn off Bot Fight Mode in Security > Bots, or RelevanBot can get a challenge that it cannot answer. Super Bot Fight Mode, on the paid plans, obeys the rule above.

Another WAF

Add a rule that allows a request when the X-Relevan-Crawl-Token header is exactly the token, and give it a higher priority than the rules that block bots. Compare the whole value, not a part of it. For example, this AWS WAF rule (JSON) allows RelevanBot when its priority number is lower than the numbers of your bot rules:

{ "Name": "allow-relevanbot", "Priority": 0, "Action": { "Allow": {} }, "Statement": { "ByteMatchStatement": { "FieldToMatch": { "SingleHeader": { "Name": "x-relevan-crawl-token" } }, "PositionalConstraint": "EXACTLY", "SearchString": "<token>", "TextTransformations": [{ "Priority": 0, "Type": "NONE" }] } }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "allow-relevanbot" } }

Contact

To report a problem with RelevanBot, email hello@relevan.dev. Include the host and the time of the requests.

Last updated on