Openstatus www.openstatus.dev

chore: subdomain rewrites (#1355)

authored by

Maximilian Kaske and committed by
GitHub
2e333cff d35821fe

+21 -1
+20
apps/status-page/next.config.ts
··· 12 12 fullUrl: true, 13 13 }, 14 14 }, 15 + async rewrites() { 16 + return { 17 + beforeFiles: [ 18 + { 19 + source: 20 + "/:path((?!api|assets|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)", 21 + has: [ 22 + { 23 + type: "host", 24 + value: 25 + process.env.NODE_ENV === "production" 26 + ? "(?<subdomain>[^.]+)\\.stpg\\.dev" 27 + : "(?<subdomain>[^.]+)\\.localhost", 28 + }, 29 + ], 30 + destination: "/:subdomain/:path*", 31 + }, 32 + ], 33 + }; 34 + }, 15 35 }; 16 36 17 37 export default nextConfig;
+1 -1
apps/status-page/src/middleware.ts
··· 26 26 type = "pathname"; 27 27 } 28 28 29 - if (url.pathname === "/") { 29 + if (url.pathname === "/" && type !== "hostname") { 30 30 return response; 31 31 } 32 32