Skip to content

Commit 8bca532

Browse files
authored
feat(console): redirect old site pages to the console (#61108)
1 parent 8c750e3 commit 8bca532

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎packages/console/app/src/middleware.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,22 @@ export default createMiddleware({
4444
status: 302,
4545
headers: { Location: "https://opencode.ai/console/login", "Cache-Control": "no-store" },
4646
})
47+
48+
// The Go, Zen, pricing, models and teams pages moved to the Console. Match the exact paths only: /zen/v1/* and
49+
// /zen/go/v1/* are the inference API, so a prefix match here would break API clients if the inference routes ever
50+
// stopped catching them.
51+
const moved = new Map([
52+
["/go", "/console/go"],
53+
["/zen", "/console/models"],
54+
["/zen/go", "/console/go"],
55+
["/pricing", "/console/go"],
56+
["/models", "/console/models"],
57+
["/teams", "/console/teams"],
58+
]).get(url.pathname.replace(/(.)\/$/, "$1"))
59+
if (moved && !locale && (event.request.method === "GET" || event.request.method === "HEAD"))
60+
return new Response(null, {
61+
status: 302,
62+
headers: { Location: `${moved}${url.search}`, "Cache-Control": "no-store" },
63+
})
4764
},
4865
})

0 commit comments

Comments
 (0)