diff --git a/src/index.ts b/src/index.ts index 693935d..aee31eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -173,6 +173,7 @@ export async function run(req: Request, ctx: Helix.UniversalContext): Promise = ['127.0.0.1', 'localhost'].includes(hostname) ? { + 'content-type': 'text/html', + 'Access-Control-Allow-Origin': 'http://localhost:3000', + 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type, Authorization', + } : { + 'content-type': 'text/html', + }; + if (lastModified) { + responseHeaders['last-modified'] = lastModified; + } + return new Response(html, { status: 200, - headers: ['127.0.0.1', 'localhost'].includes(hostname) ? { - 'content-type': 'text/html', - 'Access-Control-Allow-Origin': 'http://localhost:3000', - 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', - 'Access-Control-Allow-Headers': 'Content-Type, Authorization', - } : { - 'content-type': 'text/html', - }, + headers: responseHeaders, }); }