rfc-9309

Robots Exclusion Protocol

M. Koster, G. Illyes, H. Zeller, L. Sassman
date2022-09 streamIETF wgnon working group statusPROPOSED STANDARD pages12 canonicalhttps://www.rfc-editor.org/rfc/rfc9309 doi10.17487/RFC9309 errataview
This document specifies and extends the "Robots Exclusion Protocol" method originally defined by Martijn Koster in 1994 for service owners to control how content served by their services may be accessed, if at all, by automatic clients known as crawlers. Specifically, it adds definition language for the protocol, instructions for handling errors, and instructions for caching.

Extracted elements (26)

design-rationale §2.2.4

Crawlers MAY interpret other records not part of the robots.txt protocol (e.g., Sitemaps) and MAY be lenient with misspellings, but such parsing MUST NOT interfere with defined records. This allows extensibility while preserving core protocol integrity.

http

design-rationale §2.2.2

The longest-match rule (most octets) is used for selecting between conflicting allow/disallow rules, rather than order of appearance, to provide deterministic and more intuitive behavior for overlapping path patterns.

http

design-rationale §3

The Robots Exclusion Protocol is explicitly not a form of access authorization. Listing paths in robots.txt exposes them publicly, making them discoverable. Valid content security (e.g., HTTP Authentication) must be used separately to control actual access.

http, security

interoperability-note §2.4

Crawlers MAY use standard cache control as defined in RFC 9111 for the fetched robots.txt file, enabling interoperability with HTTP caching infrastructure.

http

interoperability-note §2.2.2

Implementors MAY bridge encoding mismatches if they detect that the robots.txt file is not UTF-8 encoded, providing tolerance for legacy or misconfigured servers.

http

normative-requirement §2.2.3 MUST

Crawlers MUST support the special characters '#' (line comment), '$' (end of match pattern), and '*' (zero or more instances of any character).

http

normative-requirement §2.3.1.5 MUST

Crawlers MUST try to parse each line of the robots.txt file and MUST use the parseable rules.

http

normative-requirement §2.2.1 MUST

Crawlers MUST use case-insensitive matching to find the group that matches the product token. If more than one group matches, the matching groups' rules MUST be combined into one group.

http

normative-requirement §2.3.1.2 MUST

Crawlers SHOULD follow at least five consecutive redirects, even across authorities. If a robots.txt file is reached within five redirects, it MUST be fetched, parsed, and its rules followed in the context of the initial authority.

http

normative-requirement §2.5 MUST

Crawlers SHOULD impose a parsing limit to protect their systems; the parsing limit MUST be at least 500 kibibytes (KiB).

http, security

normative-requirement §2.4 SHOULD NOT

Crawlers SHOULD NOT use a cached robots.txt version for more than 24 hours, unless the file is unreachable.

http

normative-requirement §2.3.1.3 MAY

If a server status code indicates robots.txt is unavailable (e.g., HTTP 400-499), the crawler MAY access any resources on the server.

http

normative-requirement §2.2.2 SHOULD

If an 'allow' rule and a 'disallow' rule are equivalent, the 'allow' rule SHOULD be used. If no match is found among rules, the URI is allowed. The /robots.txt URI is implicitly allowed.

http

normative-requirement §2.2.1 MUST

If no matching group exists, crawlers MUST obey the group with a user-agent line with the '*' value, if present. If no group matches and no '*' group exists, no rules apply.

http

normative-requirement §2.3.1.4 MUST

If robots.txt is unreachable due to server or network errors (e.g., HTTP 500-599), the crawler MUST assume complete disallow. If undefined for a reasonably long period (e.g., 30 days), crawlers MAY assume unavailability or continue using a cached copy.

http

normative-requirement §2.3.1.1 MUST

If the crawler successfully downloads the robots.txt file, the crawler MUST follow the parseable rules.

http

normative-requirement §2.2.2 MUST

Octets in the URI and robots.txt paths outside the ASCII range and those in the reserved range defined by RFC 3986 MUST be percent-encoded prior to comparison. Percent-encoded ASCII octets in the URI MUST be unencoded prior to comparison unless reserved or outside the unreserved character range.

http

normative-requirement §2.2.4 MUST NOT

Parsing of other records (e.g., Sitemaps) MUST NOT interfere with parsing of explicitly defined records. For example, a 'Sitemaps' record MUST NOT terminate a group.

http

normative-requirement §2.2.1 MUST

The product token MUST contain only uppercase and lowercase letters ('a-z' and 'A-Z'), underscores ('_'), and hyphens ('-'). It SHOULD be a substring of the identification string the crawler sends to the service.

http

normative-requirement §2.3 MUST

The robots.txt file MUST be accessible at '/robots.txt' (all lowercase) in the top-level path of the service, MUST be UTF-8 encoded, and MUST have Internet Media Type 'text/plain'.

http

normative-requirement §2.2.2 MUST

To evaluate if access to a URI is allowed, a crawler MUST match paths in 'allow' and 'disallow' rules against the URI starting with the first octet of the path; the most specific match (most octets) MUST be used.

http

protocol-element §2.1

A 'Group' consists of one or more user-agent lines followed by one or more rules, terminated by another user-agent line or end of file. The last group may have no rules, implicitly allowing everything.

http

protocol-element §2.1

A 'Rule' is a key-value pair line using 'allow' or 'disallow' directives with a path pattern, defining how a crawler may access URIs.

http

security-consideration §3

Parsers should reject out-of-bound characters as invalid to limit attack vectors, treat robots.txt content as untrusted, and enforce the 500 KiB parsing limit to protect against out-of-memory attacks.

http, security

security-consideration §3

The Robots Exclusion Protocol is not a substitute for valid content security measures. Paths listed in robots.txt are publicly exposed and discoverable; service owners should use application-layer security (e.g., HTTP Authentication per RFC 9110) to control actual access.

http, security

wire-format §2.2

The robots.txt file uses an ABNF-defined format: groups start with 'user-agent' lines (product-token), followed by 'allow'/'disallow' rule lines with path patterns. Lines are terminated by optional whitespace and optional comment preceded by '#', then NL (%x0D / %x0A / %x0D.0A).

http