tangled
alpha
login
or
join now
openstatus.dev
/
openstatus
6
fork
atom
Openstatus
www.openstatus.dev
6
fork
atom
overview
issues
pulls
pipelines
fix: url
Maximilian Kaske
5 months ago
b08a0a7b
15c87bbf
+11
-11
1 changed file
expand all
collapse all
unified
split
apps
status-page
src
middleware.ts
+11
-11
apps/status-page/src/middleware.ts
···
63
63
64
64
// custom domain redirect
65
65
if (_page.customDomain && host !== `${_page.slug}.stpg.dev`) {
66
66
-
const newURL = new URL(`https://${_page.customDomain}`);
67
67
-
const newPathname = pathname.replace(`/${_page.customDomain}`, "");
68
68
-
newURL.pathname = `/protected?redirect=${encodeURIComponent(
69
69
-
newPathname,
70
70
-
)}`;
71
71
-
console.log("redirect to /protected", newURL.toString());
72
72
-
return NextResponse.redirect(newURL);
66
66
+
const redirect = pathname.replace(`/${_page.customDomain}`, "");
67
67
+
const url = new URL(
68
68
+
`https://${
69
69
+
_page.customDomain
70
70
+
}/protected?redirect=${encodeURIComponent(redirect)}`,
71
71
+
);
72
72
+
console.log("redirect to /protected", url.toString());
73
73
+
return NextResponse.redirect(url);
73
74
}
74
75
75
76
const url = new URL(
···
84
85
85
86
// custom domain redirect
86
87
if (_page.customDomain && host !== `${_page.slug}.stpg.dev`) {
87
87
-
const newURL = new URL(`https://${_page.customDomain}`);
88
88
-
newURL.pathname = redirect ?? "/";
89
89
-
console.log("redirect to /", newURL.toString());
90
90
-
return NextResponse.redirect(newURL);
88
88
+
const url = new URL(`https://${_page.customDomain}${redirect ?? "/"}`);
89
89
+
console.log("redirect to /", url.toString());
90
90
+
return NextResponse.redirect(url);
91
91
}
92
92
93
93
return NextResponse.redirect(