Skip to content

Commit 6087b52

Browse files
committed
feat: add route handler to return 404 for all .well-known requests
1 parent 57ac67c commit 6087b52

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

__tests__/e2e/well-known.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
test.describe(".well-known", () => {
4+
test("should return 404 for .well-known/security.txt", async ({ page }) => {
5+
const response = await page.goto(
6+
"http://localhost:3000/.well-known/security.txt"
7+
);
8+
expect(response.status()).toBe(404);
9+
});
10+
11+
test("should return 404 for .well-known/apple-app-site-association", async ({
12+
page
13+
}) => {
14+
const response = await page.goto(
15+
"http://localhost:3000/.well-known/apple-app-site-association"
16+
);
17+
expect(response.status()).toBe(404);
18+
});
19+
20+
test("should return 404 for .well-known/change-password", async ({
21+
page
22+
}) => {
23+
const response = await page.goto(
24+
"http://localhost:3000/.well-known/change-password"
25+
);
26+
expect(response.status()).toBe(404);
27+
});
28+
29+
test("should return 404 for any .well-known path", async ({ page }) => {
30+
const response = await page.goto(
31+
"http://localhost:3000/.well-known/any/arbitrary/path"
32+
);
33+
expect(response.status()).toBe(404);
34+
});
35+
});
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Returns 404 for all requests to .well-known paths
3+
*/
4+
export async function GET() {
5+
return new Response(null, { status: 404 });
6+
}
7+
8+
export async function POST() {
9+
return new Response(null, { status: 404 });
10+
}
11+
12+
export async function PUT() {
13+
return new Response(null, { status: 404 });
14+
}
15+
16+
export async function DELETE() {
17+
return new Response(null, { status: 404 });
18+
}
19+
20+
export async function PATCH() {
21+
return new Response(null, { status: 404 });
22+
}
23+
24+
export async function HEAD() {
25+
return new Response(null, { status: 404 });
26+
}
27+
28+
export async function OPTIONS() {
29+
return new Response(null, { status: 404 });
30+
}

0 commit comments

Comments
 (0)