feat(console): redirect old site pages to the console (#61108)

This commit is contained in:
Dax
2026-11-01 16:46:12 -05:00
committed by GitHub
Unverified
parent 8c750e3750
commit 8bca532929
+17
View File
@@ -44,5 +44,22 @@ export default createMiddleware({
status: 302,
headers: { Location: "https://opencode.ai/console/login", "Cache-Control": "no-store" },
})
// The Go, Zen, pricing, models and teams pages moved to the Console. Match the exact paths only: /zen/v1/* and
// /zen/go/v1/* are the inference API, so a prefix match here would break API clients if the inference routes ever
// stopped catching them.
const moved = new Map([
["/go", "/console/go"],
["/zen", "/console/models"],
["/zen/go", "/console/go"],
["/pricing", "/console/go"],
["/models", "/console/models"],
["/teams", "/console/teams"],
]).get(url.pathname.replace(/(.)\/$/, "$1"))
if (moved && !locale && (event.request.method === "GET" || event.request.method === "HEAD"))
return new Response(null, {
status: 302,
headers: { Location: `${moved}${url.search}`, "Cache-Control": "no-store" },
})
},
})