Fix maintenance redirects and admin host detection

This commit is contained in:
MOH
2026-03-15 04:33:07 +01:00
parent 5d3f77962a
commit 50c3f5cce9
4 changed files with 91 additions and 18 deletions
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { getRequestHostname } from "../lib/admin-routing";
describe("admin routing helpers", () => {
it("prefers the first non-empty forwarded hostname", () => {
expect(getRequestHostname("root.mohfarawati.de", "internal-service")).toBe("root.mohfarawati.de");
});
it("normalizes ports and comma-separated proxy values", () => {
expect(getRequestHostname(undefined, "root.mohfarawati.de:443, proxy")).toBe("root.mohfarawati.de");
});
it("falls back to an empty string when no hostname exists", () => {
expect(getRequestHostname(undefined, null, "")).toBe("");
});
});