tangled
alpha
login
or
join now
openstatus.dev
/
openstatus
6
fork
atom
Openstatus
www.openstatus.dev
6
fork
atom
overview
issues
pulls
pipelines
fix: subdomain
Maximilian Kaske
6 months ago
f0eaf77b
424d38e9
+3
-18
1 changed file
expand all
collapse all
unified
split
apps
web
next.config.js
+3
-18
apps/web/next.config.js
···
45
45
async headers() {
46
46
return [{ source: "/(.*)", headers: securityHeaders }];
47
47
},
48
48
+
trailingSlash: true,
48
49
async redirects() {
49
50
return [
50
51
{
···
65
66
];
66
67
},
67
68
async rewrites() {
68
68
-
const HOST =
69
69
-
process.env.NODE_ENV === "development" ? "localhost:3001" : "stpg.dev";
70
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
84
-
// New design: proxy Next.js assets from external host when cookie indicates "new"
85
85
-
{
86
86
-
source: "/_next/:path*",
87
87
-
has: [
88
88
-
{ type: "cookie", key: "sp_mode", value: "new" },
89
89
-
{
90
90
-
type: "host",
91
91
-
value: "(?<slug>[^.]+)\\.(openstatus\\.dev|localhost)",
92
92
-
},
93
93
-
],
94
94
-
destination: `${PROTOCOL}://${HOST}/_next/:path*`,
95
95
-
},
96
82
// New design: proxy app routes to external host with slug prefix
97
83
{
98
98
-
source: "/:path((?!_next/).*)",
84
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
106
-
// NOTE: might be different on prod and localhost (without :slug)
107
107
-
destination: `${PROTOCOL}://${HOST}/:slug/:path*`,
92
92
+
destination: "https://:slug.stpg.dev/:path*",
108
93
},
109
94
],
110
95
};