Skip to content

Commit

Permalink
feat: configure internal address with envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomez committed Jan 14, 2024
1 parent 50487a1 commit 881a2b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/request/is-internal-request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NextRequest } from 'next/server'

const INTERNAL_ADDRESS = new Set(['127.0.0.1', '::ffff:127.0.0.1', '::1'])
const INTERNAL_ADDRESS = process.env.INTERNAL_ADDRESS
? new Set(process.env.INTERNAL_ADDRESS.split(','))
: new Set(['127.0.0.1', '::ffff:127.0.0.1', '::1'])

function isInternalRequest(request: NextRequest): boolean {
const authorization = request.headers.get('authorization')
Expand Down

0 comments on commit 881a2b8

Please sign in to comment.