rzo1 commented on issue #2354: URL: https://github.com/apache/stormcrawler/issues/2354#issuecomment-7275283623
Thanks for the analysis, @dpol1. These numbers are very helpful. In my view, the `www.` case is a symptom of a more general issue. Since #2077, two decisions add up: 1. a robots.txt redirect to another host is refused, and 2. a refused redirect leaves the host without rules, so nothing on it is fetched. The second point is the decisive one. For `example.com`, not even the start page is fetched, although its own redirect would have led the crawl to `www.example.com`. With the default configuration, 446 of 999 frequently visited hosts (≈45 %) are therefore not crawled at all. The current default also departs from RFC 9309, which recommends that crawlers "follow at least five consecutive redirects, even across authorities (for example, hosts in the case of HTTP)" (Section 2.3.1.2). Google follows this recommendation as well. By redirecting robots.txt, a site operator effectively adopts the target's rules as their own; that is a legitimate choice, not an attack vector in itself. A special case for `www.` would cover most of the observed cases. It would not, however, cover the reverse direction (`www.example.com` → `example.com`), other subdomains such as `m.` or language prefixes, or CDNs. I would therefore suggest the following, targeting 4.0.1: 1. **Same registrable domain:** follow redirects within the same registrable domain by default, determined via the public suffix list (`EffectiveTldFinder` from crawler-commons, which we already depend on). This covers `www.` and apex in both directions, as well as other same-site subdomains. 2. **Credentials:** do not send `http.basicauth.*` and `http.custom.headers` to another host. Dropping them on a cross-host hop, as browsers and okhttp do with `Authorization`, addresses the actual risk that motivated #2077. `http.filter.ipaddress.exclude` continues to restrict which addresses can be reached. 3. **Cross-origin in general:** once (2) is in place, I would consider following cross-origin redirects by default, in line with RFC 9309, and keeping `http.robots.redirect.crossorigin.allow: false` as the stricter option. 4. **Unchanged:** the https → http downgrade is still refused, and a refusal still ends up in the error cache instead of being treated as allow-all. Regarding opt-in versus default: I would make (1) and (2) the default. As an opt-in, the change would not help the users who start from the default configuration, and those are the ones affected most. @dpol1, could you check how many of the remaining 85 refusals would be covered by (1)? That would show whether (3) is needed in practice. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
