Skip to content

Commit 9c7739b

Browse files
authored
Adding Access-Control-Allow-Origin CORS header to lllms routes to be accessible for agents (#142)
1 parent 890457b commit 9c7739b

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/routes/llms-full[.]txt.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export const Route = createFileRoute("/llms-full.txt")({
77
GET: async () => {
88
const scan = source.getPages().map(getLLMText);
99
const scanned = await Promise.all(scan);
10-
return new Response(scanned.join("\n\n"));
10+
return new Response(scanned.join("\n\n"), {
11+
headers: {
12+
"Access-Control-Allow-Origin": "*",
13+
},
14+
});
1115
},
1216
},
1317
},

src/routes/llms[.]mdx.docs.$.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const Route = createFileRoute("/llms.mdx/docs/$")({
1212
return new Response(await page.data.getText("processed"), {
1313
headers: {
1414
"Content-Type": "text/markdown",
15+
"Access-Control-Allow-Origin": "*",
1516
},
1617
});
1718
},

src/routes/llms[.]txt.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export const Route = createFileRoute("/llms.txt")({
1111
for (const page of source.getPages()) {
1212
lines.push(`- [${page.data.title}](${page.url}): ${page.data.description}`);
1313
}
14-
return new Response(lines.join("\n"));
14+
return new Response(lines.join("\n"), {
15+
headers: {
16+
"Access-Control-Allow-Origin": "*",
17+
},
18+
});
1519
},
1620
},
1721
},

0 commit comments

Comments
 (0)