Clerk.js 公开多个页面

问题描述 投票:0回答:1

我正在使用 Clerk.JS(在 Next.JS 中)。我有一些代码看起来像:

import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware({
  publicRoutes: ["/"]
});

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};

我还想在任意 URL 上有一个公共路由,例如

example.com/test/abc123
。然而,clerk.js 似乎不允许
publicRoutes: ['test/*']
。对此最好的解决方案是什么?

javascript regex authentication public clerk
1个回答
0
投票

这应该有效

    export default authMiddleware({
        publicRoutes: ["/", 'test/:id']
    });
© www.soinside.com 2019 - 2024. All rights reserved.