From 80c513d715ef3d1a4f0a584ba41cb080be48367b Mon Sep 17 00:00:00 2001 From: Maria Florencia Besteiro Gonzalez Date: Mon, 13 Oct 2025 14:42:15 +0200 Subject: [PATCH] Merge pull request #29029 from overleaf/bg-td-mfb-increase-in-nocdn-metrics Added more bots to no cdn check GitOrigin-RevId: 53da4aad749494296df02a9026e2ba294bbba6e1 --- services/web/app/views/layout-base.pug | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index bf98fdb207..f5659f3ddc 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -129,11 +129,18 @@ html( script(type='text/javascript' nonce=scriptNonce). window.addEventListener('DOMContentLoaded', function () { + var bots = ['Bytespider', 'TikTokSpider', 'bingbot', 'Baiduspider', 'Amazonbot', 'Googlebot'] //- Look for bundle var cdnBlocked = typeof Frontend === 'undefined' //- Prevent loops var noCdnAlreadyInUrl = window.location.href.indexOf('nocdn=true') != -1 - if (cdnBlocked && !noCdnAlreadyInUrl && navigator.userAgent.indexOf('Googlebot') == -1) { + if ( + cdnBlocked && + !noCdnAlreadyInUrl && + !bots.some(function (bot) { + return navigator.userAgent.indexOf(bot) !== -1 + }) + ) { //- Set query param, server will not set CDN url window.location.search += '&nocdn=true' }