Skip to content

Commit

Permalink
chore(nextjs): Allow any charcter before file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow committed Sep 12, 2023
1 parent 65b2dce commit 4dfccd5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/nextjs/src/server/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,17 @@ type RouteMatcherWithNextTypedRoutes =

const INFINITE_REDIRECTION_LOOP_COOKIE = '__clerk_redirection_loop';

// Characters we consider to be valid in filenames: [A-Za-z0-9_-\$\(\)], used for matching static files below
const VALID_FILENAME_CHARS = '\\w-\\$\\(\\)';

/**
* The default ideal matcher that excludes the _next directory (internals) and all static files,
* but it will match the root route (/) and any routes that start with /api or /trpc.
*/
export const DEFAULT_CONFIG_MATCHER = [`/((?!.+[${VALID_FILENAME_CHARS}]+\\.[\\w]+$|_next).*)`, '/', '/(api|trpc)(.*)'];
export const DEFAULT_CONFIG_MATCHER = [`/((?!.+\\.[\\w]+$|_next).*)`, '/', '/(api|trpc)(.*)'];

/**
* Any routes matching this path will be ignored by the middleware.
* This is the inverted version of DEFAULT_CONFIG_MATCHER.
*/
export const DEFAULT_IGNORED_ROUTES = [`/((?!api|trpc))(_next.*|.+[${VALID_FILENAME_CHARS}]+\\.[\\w]+$)`];
export const DEFAULT_IGNORED_ROUTES = [`/((?!api|trpc))(_next.*|.+\\.[\\w]+$)`];
/**
* Any routes matching this path will be treated as API endpoints by the middleware.
*/
Expand Down

0 comments on commit 4dfccd5

Please sign in to comment.