Skip to content

Commit 3fefce9

Browse files
author
Alba [bot]
committed
fix: canonicalize public memroos host
1 parent b09e6fb commit 3fefce9

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

apps/memroos/public/landing/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<meta name="twitter:title" content="MemroOS - The Memory Layer for AI Agents">
1818
<meta name="twitter:description" content="Shared memory and governed orchestration for agentic product, sales, and engineering workflows.">
1919
<meta name="twitter:image" content="https://memroos.com/screenshots/memroos-og.png">
20+
<link rel="canonical" href="https://memroos.com/">
2021
<link rel="preconnect" href="https://fonts.googleapis.com">
2122
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
2223

apps/memroos/src/__tests__/proxy.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,17 @@ describe("proxy", () => {
455455
);
456456
});
457457

458+
it("redirects www public traffic to the canonical apex host", async () => {
459+
const response = await proxy(
460+
new NextRequest("https://www.memroos.com/blog?ref=gsc", {
461+
headers: { host: "www.memroos.com" },
462+
})
463+
);
464+
465+
expect(response.status).toBe(308);
466+
expect(response.headers.get("location")).toBe("https://memroos.com/blog?ref=gsc");
467+
});
468+
458469
it("allows analytics and Google Fonts endpoints in the content security policy", async () => {
459470
const response = await proxy(
460471
new NextRequest("https://memroos.com/", {

apps/memroos/src/app/__tests__/landing-research-paper.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ describe("public landing research proof", () => {
6262

6363
const landingSource = readFileSync(landingIndexPath, "utf8");
6464
expect(landingSource).toContain("See the actual product");
65+
expect(landingSource).toContain('<link rel="canonical" href="https://memroos.com/">');
6566
expect(landingSource).toContain("data-shot=\"dispatch\"");
6667
expect(landingSource).toContain("/landing/assets/shots/operator-floor.png");
6768
expect(landingSource).toContain("/landing/styles/memroos-refresh.css");

apps/memroos/src/proxy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const PUBLIC_HOSTS = new Set([
1010
"memroos.vercel.app",
1111
"memroos.localhost",
1212
]);
13+
const CANONICAL_PUBLIC_HOST = "memroos.com";
14+
const WWW_PUBLIC_HOST = "www.memroos.com";
1315
const LEGACY_HOSTS = new Set(["memroos.dev", "www.memroos.dev"]);
1416
const DEFAULT_HTTPS_APP_HOSTS = new Set<string>();
1517

@@ -236,6 +238,13 @@ export async function proxy(request: NextRequest): Promise<NextResponse> {
236238
return NextResponse.redirect("https://memroos.com/", 308);
237239
}
238240

241+
if (host === WWW_PUBLIC_HOST) {
242+
const canonicalUrl = request.nextUrl.clone();
243+
canonicalUrl.protocol = "https:";
244+
canonicalUrl.hostname = CANONICAL_PUBLIC_HOST;
245+
return withSecurityHeaders(NextResponse.redirect(canonicalUrl, 308));
246+
}
247+
239248
// Public marketing host: serve landing assets, redirect everything else to "/"
240249
if (isPublicLandingHost(host)) {
241250
if (isUnderstandRoute) {

0 commit comments

Comments
 (0)