Skip to content

Commit

Permalink
Fix: Add missing Google bot variants to bot detection
Browse files Browse the repository at this point in the history
- Include Google-InspectionTool
- Include Google-CloudVertexBot
- Include Google-Other

Resolves vercel#75032
  • Loading branch information
vitaliemiron committed Jan 17, 2025
1 parent 49e82cb commit 0ad36f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/shared/lib/router/utils/is-bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const HEADLESS_BROWSER_BOT_UA_RE =
// This regex contains the bots that we need to do a blocking render for and can't safely stream the response
// due to how they parse the DOM. For example, they might explicitly check for metadata in the `head` tag, so we can't stream metadata tags after the `head` was sent.
export const HTML_LIMITED_BOT_UA_RE_STRING =
'Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview'
'Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther'

export const HTML_LIMITED_BOT_UA_RE = new RegExp(
HTML_LIMITED_BOT_UA_RE_STRING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('app-dir - metadata-streaming-config', () => {
expect(
requiredServerFiles.config.experimental.htmlLimitedBots
).toMatchInlineSnapshot(
`"Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview"`
`"Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther"`
)

const responseConfigManifest = JSON.parse(
Expand All @@ -24,7 +24,7 @@ describe('app-dir - metadata-streaming-config', () => {

expect(responseConfigManifest).toMatchInlineSnapshot(`
{
"htmlLimitedBots": "Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview",
"htmlLimitedBots": "Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Google-InspectionTool|Google-CloudVertexBot|GoogleOther",
"version": 0,
}
`)
Expand Down

0 comments on commit 0ad36f5

Please sign in to comment.