Skip to content

Commit

Permalink
chore: fjern unødvendig middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
eskilgh committed Oct 24, 2024
1 parent 13af37d commit 48feffc
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
import { logger } from '@navikt/next-logger'

import { browserEnv, isLocal } from './utils/env'
import { browserEnv } from './utils/env'

export function middleware(request: NextRequest): NextResponse | void {
const url = new URL(request.url)
Expand All @@ -13,11 +13,6 @@ export function middleware(request: NextRequest): NextResponse | void {
logger.info('Hit old ingress, redirecting to new ingress')
return NextResponse.redirect(new URL(url.pathname, 'https://helsesjekk-bot.nav.no/'))
}

// Make sure everyone is authed now that it's on a public ingress
if (!isLocal && !request.headers.has('Authorization')) {
return NextResponse.redirect(new URL(`/oauth2/login?redirect=${url.pathname}`, request.url))
}
}

// See "Matching Paths" below to learn more
Expand Down

0 comments on commit 48feffc

Please sign in to comment.