The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { APIRoute } from "astro"; |
| 2 | |
| 3 | import { absoluteUrl } from "../../lib/seo"; |
| 4 | |
| 5 | // RFC 9116 requires an Expires date. Deriving it from the build keeps the file valid as long as |
| 6 | // the site deploys at least once a year. |
| 7 | const ONE_YEAR_MS = 365 * 24 * 60 * 60 * 1000; |
| 8 | |
| 9 | export const GET: APIRoute = () => { |
| 10 | const body = [ |
| 11 | "Contact: mailto:security@t3.codes", |
| 12 | `Policy: ${absoluteUrl("/security-policy")}`, |
| 13 | `Canonical: ${absoluteUrl("/.well-known/security.txt")}`, |
| 14 | "Preferred-Languages: en", |
| 15 | `Expires: ${new Date(Date.now() + ONE_YEAR_MS).toISOString()}`, |
| 16 | "", |
| 17 | ].join("\n"); |
| 18 | return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } }); |
| 19 | }; |