Skip to content

feat(self-host): configurable status page base domain, no Vercel when self-hosted - #3101

Open
tuergeist wants to merge 1 commit into
openstatusHQ:mainfrom
tuergeist:feat/self-host-status-page-domain
Open

tuergeist wants to merge 1 commit into
openstatusHQ:mainfrom
tuergeist:feat/self-host-status-page-domain

Conversation

@tuergeist

@tuergeist tuergeist commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Self-hosted status pages cannot use slug routing on the instance's own domain, and custom domains cannot be removed:

  • getValidSubdomain reads the slug only for hosts under openstatus.dev / stpg.dev. Any other host, e.g. acme.status.example.com behind a wildcard record, is looked up as a custom domain, so the page with slug acme is not found.
  • The dashboard and the status page hard-code {slug}.openstatus.dev (slug field suffix, onboarding, page links, canonical/alternate links, feed links).
  • Saving a custom domain always calls the Vercel API. Without Vercel the call fails, so a custom domain can be set through the API but never cleared from the dashboard. The "Domain cannot contain 'openstatus'" check also blocks e.g. status.openstatus.example.com, and the custom-domain form shows Vercel DNS/SSL instructions that do not apply.

Change

  • New runtime env STATUS_PAGE_BASE_DOMAIN (server-side, default openstatus.dev, so hosted behaviour is unchanged).
    • status-page: {slug}.{base} resolves by slug like {slug}.openstatus.dev; base URL, canonical/alternates and feed links use it (client components get it from the [domain] layout via a small context).
    • dashboard: slug suffix, onboarding summary, page links, list column and chat summaries use it, passed from the root server layout through a DeploymentConfigProvider. Read at runtime, not NEXT_PUBLIC_*, so prebuilt images can be configured.
    • api: subscriber verification links use it.
  • When SELF_HOST=true:
    • Vercel add/remove helpers are no-ops, so setting and clearing a custom domain only updates the row.
    • The "openstatus" substring check is skipped.
    • The domain status/verify/certificate endpoints return a neutral verified result without calling Vercel; the custom-domain form hides the DNS/SSL panel and shows a one-line reverse-proxy hint.
  • .env.docker.example / .env.docker-lightweight.example document the variable.

Not in this PR: apps/server (REST/RPC page routes still reject "openstatus" and build {slug}.openstatus.dev links), packages/emails, packages/subscriptions, packages/services/agent-tools, packages/react widget. Happy to follow up if the approach is fine.

Tests

New/extended unit tests in apps/status-page (base-domain, domain, resolve-route, base-url, alternates, resolve-default-rewrite), apps/dashboard (deployment-config, status-pages.client, chat tool-renderer registry) and packages/api (deployment, page.custom-domain.self-host, hosted "openstatus" rejection kept).

Local run: status-page 546 passed, dashboard 451 passed, api 448 passed; pnpm format:check clean; tsc --noEmit clean for dashboard and api.

View guided diff

… self-hosted

Add STATUS_PAGE_BASE_DOMAIN (runtime, server-side, default openstatus.dev).

Status page: hosts under the base domain resolve by slug like
*.openstatus.dev; canonical/alternate links, feed links and base URLs use
it. The client feed links get the value from a context provider set in
the [domain] server layout.

Dashboard: slug suffix, onboarding summary, page links, list column and
chat summaries use the base domain, passed from the root server layout
through DeploymentConfigProvider (with the SELF_HOST flag) so prebuilt
images pick it up at runtime.

API: when SELF_HOST is true, the Vercel add/remove helpers are no-ops,
the "openstatus" substring check is skipped, and the domain
status/verify/certificate endpoints return a neutral verified result
without calling Vercel. The custom-domain form hides the Vercel DNS/SSL
panel and shows a one-line reverse-proxy hint instead. Subscriber
verification links use the base domain.
@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@tuergeist is attempting to deploy a commit to the OpenStatus Team on Vercel.

A member of the Team first needs to authorize it.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 51 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/status-page/src/lib/alternates.test.ts">

<violation number="1" location="apps/status-page/src/lib/alternates.test.ts:67">
P2: This test bypasses the runtime configuration path by injecting `baseDomain` directly, so it will not catch a regression where alternates stop reading `STATUS_PAGE_BASE_DOMAIN`. Stub the environment and call `statusPageAlternates({ slug: "acme" })` to verify the feature end to end.</violation>
</file>

<file name="packages/api/src/router/page.custom-domain.test.ts">

<violation number="1" location="packages/api/src/router/page.custom-domain.test.ts:50">
P2: This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits `SELF_HOST=true`. Mock `../env` with `SELF_HOST: "false"` (or otherwise isolate the environment) before creating the router.</violation>
</file>

<file name="packages/api/src/router/page.custom-domain.self-host.test.ts">

<violation number="1" location="packages/api/src/router/page.custom-domain.self-host.test.ts:102">
P2: This test depends on the preceding mutation test to persist `firstDomain`; running it alone (for example with Vitest’s test-name filter) fails in `assertOwned` before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.</violation>
</file>

<file name="apps/dashboard/src/lib/deployment-config.ts">

<violation number="1" location="apps/dashboard/src/lib/deployment-config.ts:41">
P2: The dashboard and API disagree on which `SELF_HOST` values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as `1`, `yes`, or `on` do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.</violation>
</file>

<file name="apps/dashboard/src/components/chat/tool-renderers/index.tsx">

<violation number="1" location="apps/dashboard/src/components/chat/tool-renderers/index.tsx:164">
P2: The new summary uses the configured host, but expanding the same create/update result still shows the old `openstatus.dev` URL from `output.url`. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.</violation>
</file>

<file name="apps/status-page/src/lib/base-domain.ts">

<violation number="1" location="apps/status-page/src/lib/base-domain.ts:8">
P3: `normalizeBaseDomain` duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic


test("configured base domain replaces openstatus.dev", () => {
expect(
statusPageAlternates({ slug: "acme", baseDomain: "status.example.com" }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This test bypasses the runtime configuration path by injecting baseDomain directly, so it will not catch a regression where alternates stop reading STATUS_PAGE_BASE_DOMAIN. Stub the environment and call statusPageAlternates({ slug: "acme" }) to verify the feature end to end.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/status-page/src/lib/alternates.test.ts, line 67:

<comment>This test bypasses the runtime configuration path by injecting `baseDomain` directly, so it will not catch a regression where alternates stop reading `STATUS_PAGE_BASE_DOMAIN`. Stub the environment and call `statusPageAlternates({ slug: "acme" })` to verify the feature end to end.</comment>

<file context>
@@ -61,4 +61,27 @@ describe("statusPageAlternates", () => {
+
+  test("configured base domain replaces openstatus.dev", () => {
+    expect(
+      statusPageAlternates({ slug: "acme", baseDomain: "status.example.com" }),
+    ).toEqual({
+      canonical: "https://acme.status.example.com",
</file context>

expect(after?.customDomain).toBe(before?.customDomain);
});

test("page.updateCustomDomain (hosted) still rejects a domain containing 'openstatus'", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits SELF_HOST=true. Mock ../env with SELF_HOST: "false" (or otherwise isolate the environment) before creating the router.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/api/src/router/page.custom-domain.test.ts, line 50:

<comment>This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits `SELF_HOST=true`. Mock `../env` with `SELF_HOST: "false"` (or otherwise isolate the environment) before creating the router.</comment>

<file context>
@@ -46,3 +46,35 @@ test("page.updateCustomDomain rejects a taken domain before touching Vercel", as
   expect(after?.customDomain).toBe(before?.customDomain);
 });
+
+test("page.updateCustomDomain (hosted) still rejects a domain containing 'openstatus'", async () => {
+  const ctx = createInnerTRPCContext({
+    req: undefined,
</file context>

});

test("domain status endpoints answer without Vercel", async () => {
const domain = await caller.domain.getDomainResponse({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This test depends on the preceding mutation test to persist firstDomain; running it alone (for example with Vitest’s test-name filter) fails in assertOwned before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/api/src/router/page.custom-domain.self-host.test.ts, line 102:

<comment>This test depends on the preceding mutation test to persist `firstDomain`; running it alone (for example with Vitest’s test-name filter) fails in `assertOwned` before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.</comment>

<file context>
@@ -0,0 +1,137 @@
+  });
+
+  test("domain status endpoints answer without Vercel", async () => {
+    const domain = await caller.domain.getDomainResponse({
+      domain: firstDomain,
+    });
</file context>

): DeploymentConfig {
return {
statusPageBaseDomain: normalizeBaseDomain(env.STATUS_PAGE_BASE_DOMAIN),
isSelfHosted: env.SELF_HOST === "true",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The dashboard and API disagree on which SELF_HOST values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as 1, yes, or on do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/dashboard/src/lib/deployment-config.ts, line 41:

<comment>The dashboard and API disagree on which `SELF_HOST` values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as `1`, `yes`, or `on` do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.</comment>

<file context>
@@ -0,0 +1,59 @@
+): DeploymentConfig {
+  return {
+    statusPageBaseDomain: normalizeBaseDomain(env.STATUS_PAGE_BASE_DOMAIN),
+    isSelfHosted: env.SELF_HOST === "true",
+  };
+}
</file context>
Suggested change
isSelfHosted: env.SELF_HOST === "true",
isSelfHosted: ["1", "true", "yes", "on"].includes(
(env.SELF_HOST ?? "").toLowerCase(),
),

<ChangesTable changes={createStatusPageChanges(input, output)} />
),
summary: (o) => `${o.slug}.openstatus.dev`,
summary: (o, ctx) => getStatusPageHost(o.slug, ctx.statusPageBaseDomain),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new summary uses the configured host, but expanding the same create/update result still shows the old openstatus.dev URL from output.url. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/dashboard/src/components/chat/tool-renderers/index.tsx, line 164:

<comment>The new summary uses the configured host, but expanding the same create/update result still shows the old `openstatus.dev` URL from `output.url`. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.</comment>

<file context>
@@ -148,7 +161,7 @@ export const toolRenderers: ToolRendererRegistry = {
       <ChangesTable changes={createStatusPageChanges(input, output)} />
     ),
-    summary: (o) => `${o.slug}.openstatus.dev`,
+    summary: (o, ctx) => getStatusPageHost(o.slug, ctx.statusPageBaseDomain),
   },
   update_status_page: {
</file context>

* Normalizes a configured base domain to a bare lowercase hostname: drops a
* scheme, path, port and surrounding dots. An empty value means the default.
*/
export function normalizeBaseDomain(value?: string | null): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: normalizeBaseDomain duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/status-page/src/lib/base-domain.ts, line 8:

<comment>`normalizeBaseDomain` duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.</comment>

<file context>
@@ -0,0 +1,40 @@
+ * Normalizes a configured base domain to a bare lowercase hostname: drops a
+ * scheme, path, port and surrounding dots. An empty value means the default.
+ */
+export function normalizeBaseDomain(value?: string | null): string {
+  const normalized = (value ?? "")
+    .trim()
</file context>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant