Openstatus www.openstatus.dev

fix: subdomain

+3 -18
+3 -18
apps/web/next.config.js
··· 45 45 async headers() { 46 46 return [{ source: "/(.*)", headers: securityHeaders }]; 47 47 }, 48 + trailingSlash: true, 48 49 async redirects() { 49 50 return [ 50 51 { ··· 65 66 ]; 66 67 }, 67 68 async rewrites() { 68 - const HOST = 69 - process.env.NODE_ENV === "development" ? "localhost:3001" : "stpg.dev"; 70 - const PROTOCOL = process.env.NODE_ENV === "development" ? "http" : "https"; 71 69 return { 72 70 beforeFiles: [ 73 71 // Proxy app subdomain to /app ··· 81 79 ], 82 80 destination: "/app/:path*", 83 81 }, 84 - // New design: proxy Next.js assets from external host when cookie indicates "new" 85 - { 86 - source: "/_next/:path*", 87 - has: [ 88 - { type: "cookie", key: "sp_mode", value: "new" }, 89 - { 90 - type: "host", 91 - value: "(?<slug>[^.]+)\\.(openstatus\\.dev|localhost)", 92 - }, 93 - ], 94 - destination: `${PROTOCOL}://${HOST}/_next/:path*`, 95 - }, 96 82 // New design: proxy app routes to external host with slug prefix 97 83 { 98 - source: "/:path((?!_next/).*)", 84 + source: "/:path*", 99 85 has: [ 100 86 { type: "cookie", key: "sp_mode", value: "new" }, 101 87 { ··· 103 89 value: "(?<slug>[^.]+)\\.(openstatus\\.dev|localhost)", 104 90 }, 105 91 ], 106 - // NOTE: might be different on prod and localhost (without :slug) 107 - destination: `${PROTOCOL}://${HOST}/:slug/:path*`, 92 + destination: "https://:slug.stpg.dev/:path*", 108 93 }, 109 94 ], 110 95 };