Files
modstagram-next/next.config.ts
payacom a1d7db5e7e lang
2026-07-23 15:58:15 +03:30

127 lines
3.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** @type {import('next').NextConfig} */
const nextConfig = {
// ۱. نادیده گرفتن خطاهای بیلد
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
// ۲. تنظیمات تصاویر
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'api.modstagram.ir',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'app.modstagram.ir',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'blog.modstagram.com', // اجازه دادن به نمایش تصاویر وبلاگ
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'api.modstagram.com',
port: '',
pathname: '/**',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3004',
pathname: '/**',
},
],
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
minimumCacheTTL: 31536000,
},
// ۳. فقط وبلاگ — API/storage از Route Handler پروکسی می‌شوند
async rewrites() {
return [
{
source: '/blog',
destination: 'https://blog.modstagram.com/blog',
},
{
source: '/blog/:path*',
destination: 'https://blog.modstagram.com/blog/:path*',
},
];
},
// ۴. تنظیمات هدرها
async headers() {
return [
{
source: "/service-worker.js",
headers: [
{
key: "Content-Type",
value: "application/javascript; charset=utf-8",
},
{
key: "Cache-Control",
value: "public, max-age=0, must-revalidate",
},
{
key: "Service-Worker-Allowed",
value: "/",
},
],
},
{
source: "/manifest.webmanifest",
headers: [
{
key: "Content-Type",
value: "application/manifest+json; charset=utf-8",
},
{
key: "Cache-Control",
value: "no-cache, no-store, must-revalidate",
},
],
},
{
source: "/manifest.json",
headers: [
{
key: "Content-Type",
value: "application/manifest+json; charset=utf-8",
},
],
},
{
source: "/(.*)",
headers: [
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
{ key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },
{ 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: 'origin-when-cross-origin' },
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=(self), payment=()' },
{ key: 'X-Permitted-Cross-Domain-Policies', value: 'none' },
{ key: 'Cache-Control', value: 'public, s-maxage=1, stale-while-revalidate=59' },
],
},
];
},
reactStrictMode: false,
};
export default nextConfig;