Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(web): move /docs rewrite to beforeFiles (#1266)

Bohan Jiangbf31fa4b3951
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index e0b59ed8fd..2b72f46efd 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -33,32 +33,39 @@ const nextConfig: NextConfig = {
qualities: [75, 80, 85],
},
async rewrites() {
- return [
- {
- source: "/api/:path*",
- destination: `${remoteApiUrl}/api/:path*`,
- },
- {
- source: "/ws",
- destination: `${remoteApiUrl}/ws`,
- },
- {
- source: "/auth/:path*",
- destination: `${remoteApiUrl}/auth/:path*`,
- },
- {
- source: "/uploads/:path*",
- destination: `${remoteApiUrl}/uploads/:path*`,
- },
- {
- source: "/docs",
- destination: `${docsUrl}/docs`,
- },
- {
- source: "/docs/:path*",
- destination: `${docsUrl}/docs/:path*`,
- },
- ];
+ return {
+ // Run before file-system routes so /docs isn't shadowed by the
+ // [workspaceSlug] dynamic segment.
+ beforeFiles: [
+ {
+ source: "/docs",
+ destination: `${docsUrl}/docs`,
+ },
+ {
+ source: "/docs/:path*",
+ destination: `${docsUrl}/docs/:path*`,
+ },
+ ],
+ afterFiles: [
+ {
+ source: "/api/:path*",
+ destination: `${remoteApiUrl}/api/:path*`,
+ },
+ {
+ source: "/ws",
+ destination: `${remoteApiUrl}/ws`,
+ },
+ {
+ source: "/auth/:path*",
+ destination: `${remoteApiUrl}/auth/:path*`,
+ },
+ {
+ source: "/uploads/:path*",
+ destination: `${remoteApiUrl}/uploads/:path*`,
+ },
+ ],
+ fallback: [],
+ };
},
};