Skip to content

Commit

Permalink
refactor: implement basic auth compatible with vercel (#2)
Browse files Browse the repository at this point in the history
Add comment
  • Loading branch information
aahna-ashina committed May 28, 2022
1 parent aa5e8e6 commit 25a43a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/pages/api/_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export function middleware(req: NextRequest, event: NextFetchEvent) {
const pathName = req.nextUrl.pathname
console.log('pathName:', pathName)

if (pathName && pathName.startsWith('/api/push')) {
// Perform Basic Auth on these paths:
// /api/pushNotification
// /api/pushUpdate
if (pathName.startsWith('/api/push')) {
const authorizationHeader = req.headers.get('authorization')
console.log('authorizationHeader:', authorizationHeader)

Expand Down

0 comments on commit 25a43a1

Please sign in to comment.