import type { NextConfig } from "next"; const securityHeaders = [ { key: 'X-DNS-Prefetch-Control', value: 'on' }, { key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' }, { key: 'X-Frame-Options', value: 'SAMEORIGIN' }, { key: 'X-Content-Type-Options', value: 'nosniff' }, { key: 'Referrer-Policy', value: 'origin-when-cross-origin' }, { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' }, ]; const nextConfig: NextConfig = { images: { formats: ['image/avif', 'image/webp'], remotePatterns: [ { protocol: 'https', hostname: 'canina.ir', }, { protocol: 'https', hostname: 'api.canina.ir', }, { protocol: 'https', hostname: 'stage.canina.ir', }, { protocol: 'https', hostname: 'stageapi.canina.ir', }, { protocol: 'https', hostname: 'canina-iran.com', }, { protocol: 'https', hostname: 'apicanina.parsaaghayi.ir', }, { protocol: 'https', hostname: 'canina.de', }, { protocol: 'http', hostname: 'localhost', }, { protocol: 'http', hostname: '127.0.0.1', }, ], }, async headers() { return [ { source: '/:path*', headers: securityHeaders, }, ]; }, async rewrites() { // Only proxy /api in development; in production nginx handles it if (process.env.NODE_ENV === 'development') { return [ { source: '/api/:path*', destination: 'http://localhost:4001/api/:path*', }, ]; } return []; }, }; export default nextConfig;