Skip to content

Commit d93e13d

Browse files
committed
fix: Add public routes to ignoredRoutes in clerk middleware
1 parent 8174f21 commit d93e13d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/next/middleware.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import { authMiddleware } from '@clerk/nextjs'
33
import { createMiddlewareHeaderContext } from 'aetherspace/utils/serverUtils'
44
import { createRequestContext } from '@aetherspace/clerk-auth/utils/createRequestContext'
55

6+
/* --- Public Routes --------------------------------------------------------------------------- */
7+
8+
const PUBLIC_ROUTES = ['/', '/links', '/bio', '/cv', '/resume', '/sign-in', '/sign-up']
9+
610
/* --- Middleware ------------------------------------------------------------------------------ */
711

812
// -i- https://clerk.com/docs/references/nextjs/auth-middleware
913
// -i- https://nextjs.org/docs/app/api-reference/functions/next-request
1014
export default authMiddleware({
11-
publicRoutes: ['/api/graphql'],
15+
publicRoutes: ['/api/graphql', ...PUBLIC_ROUTES],
16+
ignoredRoutes: [...PUBLIC_ROUTES],
1217
async afterAuth(auth, req, evt) {
1318
// Create the request context header (to pass things like auth, user, etc. to the API)
1419
const headerContext = await createRequestContext(req, { auth, evt })

0 commit comments

Comments
 (0)