Welcome! Log In Create A New Profile

Advanced

different fastcgi_cache for bots and humans

Ian M. Evans
July 12, 2013 04:24PM
As mentioned before, I'm tweaking pixabay's version of handling the new
Google Image search traffic killer by making their trap URLs more
cacheable.

Img tags in the html will have ?i appended to the source and those "?i"
are removed for bots. I thought I could use nginx's httpsubmodule to strip
the ?i for bots, but I'd still like it cacheable, with one version for
humans and one for bots.

Doing some digging I came across an idea like this:

map $http_user_agent $botornot {
default 'human';
~(Googlebot|Bing|other|bit|names) 'bot';
}

I'm assuming I could then use $botornot in the fastcgi_cache_key? If so,
where would I place it in my current line, which is:

fastcgi_cache_key "$scheme$request_method$host$uri?$args";

Thanks.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

different fastcgi_cache for bots and humans

Ian M. Evans July 12, 2013 04:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready