mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-04 22:48:40 +08:00
fix port
This commit is contained in:
@@ -3,7 +3,8 @@ import { NextResponse } from "next/server";
|
|||||||
export function middleware(req) {
|
export function middleware(req) {
|
||||||
// Check the Host header, if HOMEPAGE_ALLOWED_HOSTS is set
|
// Check the Host header, if HOMEPAGE_ALLOWED_HOSTS is set
|
||||||
const host = req.headers.get("host");
|
const host = req.headers.get("host");
|
||||||
let allowedHosts = ["localhost:3000"];
|
const port = process.env.PORT || 3000;
|
||||||
|
let allowedHosts = [`localhost:${port}`];
|
||||||
if (process.env.HOMEPAGE_ALLOWED_HOSTS) {
|
if (process.env.HOMEPAGE_ALLOWED_HOSTS) {
|
||||||
allowedHosts = allowedHosts.concat(process.env.HOMEPAGE_ALLOWED_HOSTS.split(","));
|
allowedHosts = allowedHosts.concat(process.env.HOMEPAGE_ALLOWED_HOSTS.split(","));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user