Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions budget-app/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export function middleware(request: NextRequest) {
// See "Matching Paths" below to learn more
export const config = {
matcher: [
/*
https://github.com/Azure/static-web-apps/issues/1427
* Match all request paths except for the ones starting with:
* - .swa (Azure static web apps)
*/
'/((?!.swa).*)',
"/((?!public|_next|api/auth|api/auth/logout).*)", // match all paths not starting with 'public' or 'auth' or '_next' or 'api/auth'
],
};
16 changes: 16 additions & 0 deletions budget-app/staticwebapp.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"routes": [
{
"route": "/*",
"allowedRoles": [
"authenticated"
]
}
],
"responseOverrides": {
"401": {
"statusCode": 302,
"redirect": "/.auth/login/aad"
}
}
}