common: Block requests with unusual Host header

This commit is contained in:
LittleChest 2026-01-29 20:22:38 +08:00
parent e8c40e9d7c
commit 1a10e16745

View File

@ -7,6 +7,13 @@ export default async function handler(
rawIP,
) {
const { method, headers, url } = request;
const host = headers.get("Host");
if (host && (host.endsWith(":443") || host.endsWith(":80"))) {
return new Response(null, { status: 403 });
}
const { search, searchParams, pathname } = new URL(url);
const ip =