diff --git a/frontend/src/handler-utils/respond-to-matching-request.ts b/frontend/src/handler-utils/respond-to-matching-request.ts index 22f89ceae..b28230ce9 100644 --- a/frontend/src/handler-utils/respond-to-matching-request.ts +++ b/frontend/src/handler-utils/respond-to-matching-request.ts @@ -62,8 +62,8 @@ export const respondToTestRequest = (req: NextApiRequest, res: NextApiRespons res.status(405).send('Method not allowed') } else if (!isTestMode) { res.status(404).send('Route only available in test mode') - } else if (req.socket.remoteAddress !== '127.0.0.1' && req.socket.remoteAddress !== '::1') { - res.status(403).send('Request must come from localhost') + } else if (!['127.0.0.1', '::1', '::ffff:127.0.0.1'].includes(req.socket.remoteAddress)) { + res.status(403).send(`Request must come from localhost but was ${req.socket.remoteAddress}`) } else { res.status(200).json(response()) }