Skip to content

Commit

Permalink
docs: localePrefix: 'never' is useful for domain-based routing too
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Nov 28, 2023
1 parent 97769a7 commit 18157bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/pages/docs/routing/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ In this case, requests where the locale prefix matches the default locale will b

#### Never use a locale prefix [#locale-prefix-never]

For applications behind an authentication layer, where there is no need for SEO, it is possible to have the locale never show up in the URL.
If you're building an app behind an authentication layer, where there is no need for SEO, or you're using [domain-based routing](#domain-based-routing) and you have distinct domains per locale, you can configure the middleware to never show a locale prefix in the URL.

```tsx filename="middleware.ts" {6}
import createMiddleware from 'next-intl/middleware';
Expand Down Expand Up @@ -448,8 +448,8 @@ export default async function middleware(req: NextRequest) {
});
const res = handleI18nRouting(req);

const supabase = createMiddlewareClient<Database>({ req, res })
await supabase.auth.getSession()
const supabase = createMiddlewareClient<Database>({req, res});
await supabase.auth.getSession();

return res;
}
Expand Down

2 comments on commit 18157bc

@vercel
Copy link

@vercel vercel bot commented on 18157bc Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 18157bc Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-docs – ./docs

next-intl-docs.vercel.app
next-intl-docs-next-intl.vercel.app
next-intl-docs-git-main-next-intl.vercel.app

Please sign in to comment.