Spaces:
Running
Running
feat: redirect /invite paths to /app/invite to support SPA routing structure
Browse files- health-server.js +9 -0
health-server.js
CHANGED
|
@@ -862,6 +862,15 @@ const server = http.createServer((req, res) => {
|
|
| 862 |
return;
|
| 863 |
}
|
| 864 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 865 |
// ββ /app/* β strip prefix, proxy to Paperclip βββββββββββββββββββββββββββββ
|
| 866 |
// SPA built with basename="/app"; React Router strips /app client-side.
|
| 867 |
if (pathname === "/app" || pathname.startsWith("/app/")) {
|
|
|
|
| 862 |
return;
|
| 863 |
}
|
| 864 |
|
| 865 |
+
// ββ /invite/* β redirect to /app/invite/* (SPA uses basename="/app") ββββββββ
|
| 866 |
+
if (pathname.startsWith("/invite/") || pathname === "/invite") {
|
| 867 |
+
const rest = pathname.slice("/invite".length) || "/";
|
| 868 |
+
const query = parsedUrl.search || "";
|
| 869 |
+
res.writeHead(302, { Location: "/app/invite" + rest + query });
|
| 870 |
+
res.end();
|
| 871 |
+
return;
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
// ββ /app/* β strip prefix, proxy to Paperclip βββββββββββββββββββββββββββββ
|
| 875 |
// SPA built with basename="/app"; React Router strips /app client-side.
|
| 876 |
if (pathname === "/app" || pathname.startsWith("/app/")) {
|