Update middleware.js

This commit is contained in:
shamoon 2025-01-27 16:01:44 -08:00
parent ee7be33fa1
commit eeda1563fd

View File

@ -6,6 +6,7 @@ export function middleware(req) {
const allowedHosts = process.env.HOMEPAGE_ALLOWED_HOSTS
? process.env.HOMEPAGE_ALLOWED_HOSTS.split(",").concat(["localhost:3000"])
: [];
console.log("Host: ", host, "Allowed Hosts: ", allowedHosts);
if (allowedHosts.length && !(host || allowedHosts.includes(host))) {
return new NextResponse("Invalid Host header", { status: 400 });
}