diff --git a/api/article-og.ts b/api/article-og.ts
index 89089ee0..0253e882 100644
--- a/api/article-og.ts
+++ b/api/article-og.ts
@@ -215,6 +215,17 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
const userAgent = req.headers['user-agent'] as string | undefined
const isCrawlerRequest = isCrawler(userAgent)
+ const debugEnabled = req.query.debug === '1' || req.headers['x-boris-debug'] === '1'
+ if (debugEnabled) {
+ console.log('[article-og] request', JSON.stringify({
+ naddr,
+ ua: userAgent || null,
+ isCrawlerRequest,
+ path: req.url || null
+ }))
+ res.setHeader('X-Boris-Debug', '1')
+ }
+
// If it's a regular browser (not a bot), serve HTML that loads SPA
// Use history.replaceState to set the URL before the SPA boots
if (!isCrawlerRequest) {
@@ -233,6 +244,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
history.replaceState(null, '', '${articlePath}');
}
+ ${debugEnabled ? `` : ''}