Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Azure Static Web App deployment #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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"
}
}
}
Loading