We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a6cd73 commit 8c3f16bCopy full SHA for 8c3f16b
1 file changed
src/dev/vfs.ts
@@ -15,8 +15,9 @@ export function createVFSHandler(nitro: Nitro) {
15
socket?.readable && socket?.writable && !socket?.remotePort;
16
17
const ip = getRequestIP(event, { xForwardedFor: isUnixSocket });
18
+ const v4 = ip?.toLowerCase().startsWith("::ffff:") ? ip.slice(7) : ip;
19
- const isLocalRequest = ip && /^::1$|^127\.\d+\.\d+\.\d+$/.test(ip);
20
+ const isLocalRequest = v4 && /^(?:::1|127\.\d+\.\d+\.\d+)$/.test(v4);
21
if (!isLocalRequest) {
22
throw new HTTPError({
23
statusText: `Forbidden IP: "${ip || "?"}"`,
0 commit comments