Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(server): stop the trailing-slash redirect from leaving the origin

nirholasc7e2f7194c8c
diff --git a/server/index.mjs b/server/index.mjs
index c6edc09ff..d8e8afe36 100644
--- a/server/index.mjs
+++ b/server/index.mjs
@@ -421,7 +421,10 @@ app.use(async (req, res) => {
currentPath.endsWith('/') &&
!currentPath.startsWith('/api/')
) {
- const bare = currentPath.replace(/\/+$/, '') || '/';
+ // Leading slashes collapse too: dot segments (`/.//evil.com/`) parse to a
+ // pathname of `//evil.com/`, and a Location of `//evil.com` is a
+ // protocol-relative redirect off this origin.
+ const bare = currentPath.replace(/\/+$/, '').replace(/^\/+/, '/') || '/';
res.redirect(301, bare + url.search);
return;
}