// Production entry: Astro's standalone Node handler (static files + on-demand pages) // wrapped to add the security headers nginx used to set. process.env.ASTRO_NODE_AUTOSTART = 'disabled'; import http from 'node:http'; const { handler } = await import('./dist/server/entry.mjs'); const SECURITY_HEADERS = { 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'X-Frame-Options': 'DENY', }; const port = Number(process.env.PORT ?? 8080); const host = process.env.HOST ?? '0.0.0.0'; const server = http.createServer((req, res) => { for (const [name, value] of Object.entries(SECURITY_HEADERS)) res.setHeader(name, value); handler(req, res); }); server.listen(port, host, () => console.log(`Listening on http://${host}:${port}`)); for (const signal of ['SIGINT', 'SIGTERM']) { process.on(signal, () => server.close(() => process.exit(0))); }