mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 18:26:32 -05:00
fix(frontend): improve mock api error message for source ip
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e953a5115a
commit
7037c9f6ca
1 changed files with 2 additions and 2 deletions
|
@ -62,8 +62,8 @@ export const respondToTestRequest = <T>(req: NextApiRequest, res: NextApiRespons
|
||||||
res.status(405).send('Method not allowed')
|
res.status(405).send('Method not allowed')
|
||||||
} else if (!isTestMode) {
|
} else if (!isTestMode) {
|
||||||
res.status(404).send('Route only available in test mode')
|
res.status(404).send('Route only available in test mode')
|
||||||
} else if (req.socket.remoteAddress !== '127.0.0.1' && req.socket.remoteAddress !== '::1') {
|
} 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')
|
res.status(403).send(`Request must come from localhost but was ${req.socket.remoteAddress}`)
|
||||||
} else {
|
} else {
|
||||||
res.status(200).json(response())
|
res.status(200).json(response())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue