From 257d14f60b7a3b697cb6ee9bca18a2de2d6b27ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CKangShinGyu=E2=80=9D?= <“rkdtlseb@naver.com”> Date: Tue, 6 Oct 2026 14:09:14 +0900 Subject: [PATCH] =?UTF-8?q?hotfitx(join):=EC=B9=B4=ED=86=A1=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=B4=88=EB=8C=80=EC=8B=9C=20=EB=B9=88=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/proxy.test.ts | 17 ++++++++++++++++- src/proxy.ts | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/proxy.test.ts b/src/proxy.test.ts index 05ea7925..e68b793c 100644 --- a/src/proxy.test.ts +++ b/src/proxy.test.ts @@ -33,13 +33,15 @@ describe("invite preview proxy indexing contract", () => { it.each([ "Discordbot/2.0", "KAKAOTALK-SCRAP/1.0", + "facebookexternalhit/1.1; kakaotalk-scrap/1.0; +https://devtalk.kakao.com/t/scrap/33984", "Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)", "facebookexternalhit/1.1", "Twitterbot/1.0", "LinkedInBot/1.0", "TelegramBot (like TwitterBot)", "WhatsApp/2.23", - "Line/13.0", + "line-poker/1.0", + "facebookexternalhit/1.1;line-poker/1.0", ])("rewrites supported social preview UA %s with noindex headers", async (ua) => { const response = await proxy(inviteRequest(ua)); @@ -62,6 +64,19 @@ describe("invite preview proxy indexing contract", () => { expect(response.headers.get("x-middleware-next")).toBe("1"); expect(verifySessionWithOptionalRefresh).toHaveBeenCalledOnce(); }); + + it.each([ + "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 KAKAOTALK 10.8.0", + "Mozilla/5.0 (Linux; Android 14; SM-S918N Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.82 Mobile Safari/537.36;KAKAOTALK 2410800", + "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari Line/14.8.0", + "Mozilla/5.0 (Linux; Android 14; SM-S918N Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.82 Mobile Safari/537.36 Line/14.8.0/IAB", + ])("serves the app page to in-app browser UA %s", async (ua) => { + const response = await proxy(inviteRequest(ua)); + + expect(response.headers.get("x-middleware-rewrite")).toBeNull(); + expect(response.headers.get("x-middleware-next")).toBe("1"); + expect(verifySessionWithOptionalRefresh).toHaveBeenCalledOnce(); + }); }); describe("protected route redirect indexing contract", () => { diff --git a/src/proxy.ts b/src/proxy.ts index a5113a52..902ef09e 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -7,7 +7,7 @@ import { verifySessionWithOptionalRefresh } from "@/lib/auth-server"; import { isProtectedAppPath } from "@/lib/auth-session"; const LINK_PREVIEW_BOT_UA = - /facebookexternalhit|kakaotalk|twitterbot|slackbot|discordbot|linkedinbot|telegrambot|whatsapp|(?:^|[\s;(])line(?:\/|[\s;)])/i; + /facebookexternalhit|kakaotalk-scrap|line-poker|twitterbot|slackbot|discordbot|linkedinbot|telegrambot|whatsapp/i; function isInvitePreviewRequest(request: NextRequest): boolean { const { pathname } = request.nextUrl;