import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
  site: 'https://insanitylab.tielogic.xyz',
  output: 'server',
  // Dietro Traefik il TLS termina al proxy: senza allowedDomains Astro ignora
  // X-Forwarded-Proto/Host e il checkOrigin CSRF respinge i POST (403).
  security: {
    allowedDomains: [{ hostname: 'insanitylab.tielogic.xyz', protocol: 'https' }],
  },
  adapter: node({ mode: 'standalone' }),
  // La sezione "Programmi" è stata rinominata "Servizi": redirect permanenti dai vecchi URL.
  redirects: {
    '/programs': { status: 301, destination: '/services' },
    '/programs/[slug]': { status: 301, destination: '/services/[slug]' },
  },
});
