From 881a2b8de5b6a88a1d20fe659663a610bad5605d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Go=CC=81mez=20Bachiller?= <sergio.gomez@audiense.com> Date: Sun, 14 Jan 2024 20:18:43 +0100 Subject: [PATCH] feat: configure internal address with envvar --- src/request/is-internal-request.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/request/is-internal-request.ts b/src/request/is-internal-request.ts index fc19783..777c514 100644 --- a/src/request/is-internal-request.ts +++ b/src/request/is-internal-request.ts @@ -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')