diff --git a/proxy/nginx-botbegone.conf b/proxy/nginx-botbegone.conf new file mode 100644 index 00000000..21996f5a --- /dev/null +++ b/proxy/nginx-botbegone.conf @@ -0,0 +1,21 @@ +# prevent top 6 bots from entering data into /_tracking +## Googlebot/ +## Y!J +## Yeti +## Bytespider +## Applebot +## HeadlessChrome + +set $botstracking 0; + +if ($uri = "/_tracking") { + set $botstracking 1; +} + +if ($http_user_agent ~ 'Googlebot/|Y!J|Yeti|Bytespider|Applebot|HeadlessChrome') { + set $botstracking "${botstracking}1"; +} + +if ($botstracking = 11) { + return 200; +} diff --git a/proxy/nginx.conf b/proxy/nginx.conf index 46991cd3..ae399678 100644 --- a/proxy/nginx.conf +++ b/proxy/nginx.conf @@ -38,6 +38,7 @@ http { server_name {{env "EXTERNAL_ROUTE"}} {{env "PUBLIC_ROUTE"}}; include nginx-cloudfront.conf; + include nginx-botbegone.conf; include nginx-common.conf; }