Add custom domain support for published status pages.

Fixes #3647
This commit is contained in:
Ian Troisi committed 2026-06-07 22:37:24 -04:00
1 parent 80d6868a1d
commit 30e8cfc9ec
25 files changed
+13919 -11044

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
export const normalizeStatusPageDomain = (value?: string | null): string | null => {
if (typeof value !== "string") {
return null;
}
const trimmed = value.trim().toLowerCase();
if (!trimmed) {
return null;
}
// Strip scheme, path, and port if a full URL was pasted.
const withoutScheme = trimmed.replace(/^https?:\/\//, "");
const hostname = withoutScheme.split("/")[0]?.split(":")[0] ?? "";
return hostname || null;
};
export const resolveStatusPageDomainFromRequest = (hostHeader?: string | null, queryDomain?: string | null): string | null => {
const fromQuery = normalizeStatusPageDomain(queryDomain);
if (fromQuery) {
return fromQuery;
}
if (!hostHeader) {
return null;
}
return normalizeStatusPageDomain(hostHeader.split(":")[0]);
};