From 116c4c83d140f230b0dde30b3a833f63c83a6ae4 Mon Sep 17 00:00:00 2001 From: Thada Wangthammang Date: Sat, 24 Aug 2024 19:42:03 +0700 Subject: [PATCH 1/2] misc(budget-app): add authenticated route for azure static web app --- budget-app/staticwebapp.config.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 budget-app/staticwebapp.config.json diff --git a/budget-app/staticwebapp.config.json b/budget-app/staticwebapp.config.json new file mode 100644 index 0000000..a5f017b --- /dev/null +++ b/budget-app/staticwebapp.config.json @@ -0,0 +1,16 @@ +{ + "routes": [ + { + "route": "/*", + "allowedRoles": [ + "authenticated" + ] + } + ], + "responseOverrides": { + "401": { + "statusCode": 302, + "redirect": "/.auth/login/aad" + } + } +} \ No newline at end of file From bede034da5e356821ae9ba2809fad6b1511c619e Mon Sep 17 00:00:00 2001 From: Thada Wangthammang Date: Sat, 24 Aug 2024 21:17:15 +0700 Subject: [PATCH 2/2] misc(budget-app): fix deploy timeout issue --- budget-app/src/middleware.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/budget-app/src/middleware.ts b/budget-app/src/middleware.ts index 2f8fff3..4ba98a6 100644 --- a/budget-app/src/middleware.ts +++ b/budget-app/src/middleware.ts @@ -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' ], };