From: Tobias Geerinckx-Rice via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 52338@debbugs.gnu.org, leo@famulari.name
Subject: bug#52338: Crawler bots are downloading substitutes
Date: Thu, 09 Dec 2021 16:42:24 +0100 [thread overview]
Message-ID: <87sfv1ivl2.fsf@nckx> (raw)
In-Reply-To: <87tufh6h85.fsf_-_@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1469 bytes --]
Mathieu Othacehe 写道:
> Hello Leo,
>
>> + (nginx-location-configuration
>> + (uri "/robots.txt")
It's a micro-optimisation, but it can't hurt to generate ‘location
= /robots.txt’ instead of ‘location /robots.txt’ here.
>> + (body
>> + (list
>> + "add_header Content-Type text/plain;"
>> + "return 200 \"User-agent: *\nDisallow:
>> /nar/\n\";"))))))
Use \r\n instead of \n, even if \n happens to work.
There are many ‘buggy’ crawlers out there. It's in their own
interest to be fussy whilst claiming to respect robots.txt. The
less you deviate from the most basic norm imaginable, the better.
I tested whether embedding raw \r\n bytes in nginx.conf strings
like this works, and it seems to, even though a human would
probably not do so.
> Nice, the bots are also accessing the Cuirass web interface, do
> you
> think it would be possible to extend this snippet to prevent it?
You can replace ‘/nar/’ with ‘/’ to disallow everything:
Disallow: /
If we want crawlers to index only the front page (so people can
search for ‘Guix CI’, I guess), that's possible:
Disallow: /
Allow: /$
Don't confuse ‘$’ with ‘supports regexps’. Buggy bots might fall
back to ‘Disallow: /’.
This is where it gets ugly: nginx doesn't support escaping ‘$’ in
strings. At all. It's insane.
[-- Attachment #1.2: Type: text/plain, Size: 201 bytes --]
geo $dollar { default "$"; } #
stackoverflow.com/questions/57466554
server {
location = /robots.txt {
return 200
"User-agent: *\r\nDisallow: /\r\nAllow: /$dollar\r\n";
}
}
[-- Attachment #1.3: Type: text/plain, Size: 99 bytes --]
*Obviously.*
An alternative to that is to serve a real on-disc robots.txt.
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
next prev parent reply other threads:[~2021-12-09 16:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 21:20 bug#52338: Crawler bots are downloading substitutes Leo Famulari
2021-12-06 22:18 ` bug#52338: [maintenance] hydra: berlin: Create robots.txt Leo Famulari
2021-12-09 13:27 ` bug#52338: Crawler bots are downloading substitutes Mathieu Othacehe
2021-12-09 15:42 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix [this message]
2021-12-10 16:22 ` Leo Famulari
2021-12-10 16:47 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2021-12-11 9:46 ` Mathieu Othacehe
2021-12-19 16:53 ` Mathieu Othacehe
2021-12-10 21:21 ` Mark H Weaver
2021-12-10 22:52 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfv1ivl2.fsf@nckx \
--to=bug-guix@gnu.org \
--cc=52338@debbugs.gnu.org \
--cc=leo@famulari.name \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).