Fix maintenance redirects and admin host detection
This commit is contained in:
@@ -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("");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user