canina/frontend/application/next.config.ts
2026-08-06 23:02:07 +03:30

57 lines
1.3 KiB
TypeScript

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-iran.com',
},
{
protocol: 'https',
hostname: 'apicanina.parsaaghayi.ir',
},
{
protocol: 'https',
hostname: 'canina.de',
},
{
protocol: 'http',
hostname: 'localhost',
},
],
},
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;