Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
fix: config host value
Maximilian Kaske0ac4c5750511
diff --git a/apps/web/next.config.js b/apps/web/next.config.jsindex a8951d503..cee7f26f5 100644--- a/apps/web/next.config.js+++ b/apps/web/next.config.js@@ -85,7 +85,10 @@ const nextConfig = {source: "/_next/:path*",has: [{ type: "cookie", key: "sp_mode", value: "new" },- { type: "host", value: "(?<slug>[^.]+)\\.(stpg\\.dev|localhost)" },+ {+ type: "host",+ value: "(?<slug>[^.]+)\\.(openstatus\\.dev|localhost)",+ },],destination: `http://${NEW_HOST}/_next/:path*`,},@@ -94,7 +97,10 @@ const nextConfig = {source: "/:path((?!_next/).*)",has: [{ type: "cookie", key: "sp_mode", value: "new" },- { type: "host", value: "(?<slug>[^.]+)\\.(stpg\\.dev|localhost)" },+ {+ type: "host",+ value: "(?<slug>[^.]+)\\.(openstatus\\.dev|localhost)",+ },],// NOTE: we don't need the slug `/:slug/:path*` here because it will already be applied in the rewrites in the status-page app as subdomaindestination: `http://${NEW_HOST}/:path*`,diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.tsindex ac45c03a6..74cb6ed86 100644--- a/apps/web/src/middleware.ts+++ b/apps/web/src/middleware.ts@@ -64,12 +64,16 @@ export default auth(async (req) => {const pathname = req.nextUrl.pathname;const subdomain = getValidSubdomain(host);+ console.log({ subdomain });+// Subdomain handling: set mode cookie (legacy/new) and let next.config rewrites proxyif (subdomain) {const modeCookie = req.cookies.get("sp_mode")?.value; // "legacy" | "new"const cached = modeCookie === "legacy" || modeCookie === "new";let mode: "legacy" | "new" | undefined = cached ? modeCookie : undefined;+ console.log({ mode, cached });+if (!mode) {try {const redis = Redis.fromEnv();@@ -81,6 +85,8 @@ export default auth(async (req) => {}}+ console.log({ mode });+if (mode === "legacy") {url.pathname = `/status-page/${subdomain}${url.pathname}`;return NextResponse.rewrite(url);@@ -104,15 +110,15 @@ export default auth(async (req) => {}const isPublicAppPath = publicAppPaths.some((path) =>- pathname.startsWith(path),+ pathname.startsWith(path));if (!req.auth && pathname.startsWith("/app/invite")) {return NextResponse.redirect(new URL(`/app/login?redirectTo=${encodeURIComponent(req.nextUrl.href)}`,- req.url,- ),+ req.url+ ));}@@ -120,8 +126,8 @@ export default auth(async (req) => {return NextResponse.redirect(new URL(`/app/login?redirectTo=${encodeURIComponent(req.nextUrl.href)}`,- req.url,- ),+ req.url+ ));}@@ -140,7 +146,7 @@ export default auth(async (req) => {if (hasWorkspaceSlug) {const hasAccessToWorkspace = allowedWorkspaces.find(- ({ workspace }) => workspace.slug === workspaceSlug,+ ({ workspace }) => workspace.slug === workspaceSlug);if (hasAccessToWorkspace) {const workspaceCookie = req.cookies.get("workspace-slug")?.value;@@ -158,7 +164,7 @@ export default auth(async (req) => {const firstWorkspace = allowedWorkspaces[0].workspace;const { slug } = firstWorkspace;return NextResponse.redirect(- new URL(`/app/${slug}/monitors`, req.url),+ new URL(`/app/${slug}/monitors`, req.url));}}