Files
clock/next.config.ts

116 lines
2.6 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: 'standalone',
// Optimisations de production
reactStrictMode: true,
// Supprimer le header X-Powered-By pour la sécurité
poweredByHeader: false,
// Optimisation des images
images: {
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
// Headers de sécurité, cache et SEO
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
],
},
{
source: '/manifest.json',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
{
key: 'Content-Type',
value: 'application/manifest+json',
},
],
},
{
// Cache statiques (images, fonts, icons)
source: '/:path*.(ico|png|jpg|jpeg|svg|webp|avif|woff|woff2)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
// Sitemap et robots : cache court pour que Google voit les mises à jour
source: '/(sitemap.xml|robots.txt)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=3600, s-maxage=86400',
},
],
},
];
},
// Redirections pour des URL propres
async redirects() {
return [
{
source: '/index',
destination: '/',
permanent: true,
},
{
source: '/home',
destination: '/',
permanent: true,
},
];
},
// Compression
compress: true,
// Optimisation du bundle
experimental: {
optimizeCss: true,
},
};
export default nextConfig;