mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
The OG function deployed and worked (`/api/og?v=<nevent>` returns the real title, description, thumbnail and player card), but crawlers hitting `/?v=<nevent>` still got the site-wide card: Vercel evaluates `rewrites` AFTER the filesystem, and `/` matches the static index.html, so the rewrite never fired. Middleware runs before the filesystem check, so that is where the routing belongs. Replace the dead `rewrites` block with a root middleware that matches only `/`, bails immediately when there is no `v` param or the user-agent is not a known preview crawler, and otherwise rewrites to /api/og. Real viewers are unaffected -- they fall through to the untouched SPA. Note the one behavioral difference from the rewrite design: middleware now executes on homepage requests (matcher is `/` only) rather than being invoked solely for crawlers. It returns next() after two cheap checks. Verified on the live unstable deployment that /api/og already renders `x-bitvid-og: video` with og:type video.other for the real note; this only fixes how crawlers reach it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
40 lines
699 B
JSON
40 lines
699 B
JSON
{
|
|
"buildCommand": "npm run build",
|
|
"outputDirectory": "dist",
|
|
"installCommand": "npm install",
|
|
"git": {
|
|
"deploymentEnabled": {
|
|
"unstable": true
|
|
}
|
|
},
|
|
"headers": [
|
|
{
|
|
"source": "/sw.min.js",
|
|
"headers": [
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "no-cache, must-revalidate"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"source": "/",
|
|
"headers": [
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "no-cache, must-revalidate"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"source": "/(.*\\.html)",
|
|
"headers": [
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "no-cache, must-revalidate"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|