Line 0
Link Here
|
|
|
1 |
RewriteEngine on |
2 |
|
3 |
#NOTE: To override this setting of ANTIBOT_DO, in the parent VirtualHost add the following: SetEnvIf Request_URI ^ ANTIBOT_OVERRIDE=true |
4 |
#You can then provide your own conditions for setting the ANTIBOT_DO environmental variable |
5 |
RewriteCond %{ENV:ANTIBOT_OVERRIDE} ^$ |
6 |
RewriteCond expr "%{REQUEST_URI} =~ m#^/cgi-bin/koha/(opac-detail.pl|opac-export.pl|opac-suggestions.pl|opac-search.pl|opac-authoritiesdetail.pl|opac-ISBDdetail.pl|opac-MARCdetail.pl|opac-shelves.pl)$#" |
7 |
RewriteCond %{HTTP:Cookie} !(^|;\s*)CGISESSID= [NC] |
8 |
RewriteCond %{HTTP:Cookie} !(^|;\s*)KOHA_INIT= [NC] |
9 |
RewriteRule ^ - [E=ANTIBOT_DO:true] |
10 |
|
11 |
#NOTE: The below is the core of the antibot action. |
12 |
|
13 |
#Set the KOHA_INIT cookie to tag the requester and prevent redirect loops in browsers |
14 |
Header always set Set-Cookie "KOHA_INIT=1; Path=/; HttpOnly; SameSite=Lax" env=ANTIBOT_DO |
15 |
|
16 |
#NOTE: Internal redirect to our challenge page |
17 |
RewriteCond %{ENV:ANTIBOT_DO} ^true$ |
18 |
RewriteRule ^ /opac-tmpl/lib/koha_fast_challenge/index.html [L,PT] |