canina/frontend/application/next.config.ts
parsa aghaei c7d7ac3aa3
Some checks failed
Deploy Canina / deploy (push) Successful in 1m51s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
fix(media): resolve 400 Bad Request on next/image proxy, add auto scroll to top on route change, disable swagger in prod, and fix dev ports
2026-08-29 13:37:50 +03:30

102 lines
2.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'],
minimumCacheTTL: 31536000,
localPatterns: [
{
pathname: '/**',
},
],
remotePatterns: [
{
protocol: 'https',
hostname: 'canina.ir',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'api.canina.ir',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'stage.canina.ir',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'stageapi.canina.ir',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'apicanina.parsaaghayi.ir',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'canina.de',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'www.canina.de',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'plus.unsplash.com',
pathname: '/**',
},
{
protocol: 'http',
hostname: 'localhost',
pathname: '/**',
},
{
protocol: 'http',
hostname: '127.0.0.1',
pathname: '/**',
},
],
},
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
];
},
async rewrites() {
// Only proxy /api in development; exclude local Next.js route handlers such as /api/revalidate
if (process.env.NODE_ENV === 'development') {
return [
{
source: '/api/((?!revalidate).*)',
destination: 'http://localhost:4001/api/$1',
},
];
}
return [];
},
};
export default nextConfig;