Next.js Discord

Discord Forum

add Auth for subdomain page like vercel.pub

Unanswered
Palomino posted this in #help-forum
Open in Discord
PalominoOP
I am trying to make something like https://vercel.pub and I have to add Clerk Authentication in the middleware.
import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware({
  publicRoutes: [
    "/api/webhooks(.*)",
    "/api/trigger",
    "/api/status",
    "/api/uploadthing",
    "/api/status"
  ],
});
export const config = {
  matcher: [
      "/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)",
      "/((?!api/|_next/|_static/|_vercel|[\\w-]+\\.\\w+).*)",
  ],
};

I have added the Clerk's authMiddleware function but I don't know where to add the subdomain redirect middleware.

0 Replies