Skip to content

Commit db0217c

Browse files
authored
Merge pull request #1673 from mars-protocol/update-ogs
feat: add SSR rewrites for vault detail pages targeting bot user agents
2 parents b082c0d + 3558a36 commit db0217c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

next.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ const nextConfig = {
5757
},
5858
async rewrites() {
5959
return [
60+
// Rewrite vault detail pages for bots to SSR endpoint
61+
{
62+
source: '/vaults/:vaultAddress/details',
63+
destination: '/api/ssr/vaults/:vaultAddress',
64+
has: [
65+
{
66+
type: 'header',
67+
key: 'User-Agent',
68+
value:
69+
'(facebook|twitter|linkedin|telegram|discord|bot|crawl|spider|facebookexternalhit|Facebot|Twitterbot|TelegramBot|XtilesBot)',
70+
},
71+
],
72+
},
73+
// Also handle wallet-prefixed vault URLs for bots
74+
{
75+
source: '/wallets/:wallet/vaults/:vaultAddress/details',
76+
destination: '/api/ssr/vaults/:vaultAddress',
77+
has: [
78+
{
79+
type: 'header',
80+
key: 'User-Agent',
81+
value:
82+
'(facebook|twitter|linkedin|telegram|discord|bot|crawl|spider|facebookexternalhit|Facebot|Twitterbot|TelegramBot|XtilesBot)',
83+
},
84+
],
85+
},
6086
// Rewrite frontend routes for non-bot user agents (excluding API routes)
6187
{
6288
source: '/((?!api|_next|favicon).*)',

0 commit comments

Comments
 (0)