$bot_producer
The $bot_producer variable is set by the device-type module in NGINX. It holds the name of the organization or entity that operates a detected bot. This variable is only set when a request is identified as originating from a bot.
Type
String
Possible values
Google: Indicates the bot is operated by Google.OpenAI: Indicates the bot is operated by OpenAI.Anthropic: Indicates the bot is operated by Anthropic.
Examples
Logging Bot Producers
You can log the bot producer for requests identified as bots.
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$bot_producer"';
access_log /var/log/nginx/access.log main;
Adding a Custom Header for Bots
Add a custom header to responses for requests from bots, indicating the bot producer.
location / {
if ($is_bot) {
add_header X-Bot-Producer $bot_producer;
}
proxy_pass http://backend;
}
Conditional Access Control
Deny access to certain paths for bots from specific producers.
location /sensitive-data {
if ($bot_producer = "OpenAI") {
return 403;
}
proxy_pass http://backend;
}