Merge pull request #29029 from overleaf/bg-td-mfb-increase-in-nocdn-metrics

Added more bots to no cdn check

GitOrigin-RevId: 53da4aad749494296df02a9026e2ba294bbba6e1
This commit is contained in:
Maria Florencia Besteiro Gonzalez
2025-10-13 14:42:15 +02:00
committed by Copybot
parent d6076a0b32
commit 80c513d715

View File

@@ -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'
}