Files
modstagram-next/next.config.ts
payacom 491040f752 rezerv
2026-08-05 15:12:39 +03:30

175 lines
4.6 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: 'https',
hostname: 'app.modstagram.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'panel.modstagram.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'cdn.modstagram.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'api.qrserver.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,
},
// ۳. ریدایرکت دائمی دامنه قدیمی .ir به دامنه اصلی .com
async redirects() {
return [
{
source: '/:path*',
has: [{ type: 'host', value: 'modstagram.ir' }],
destination: 'https://modstagram.com/:path*',
permanent: true,
},
{
source: '/:path*',
has: [{ type: 'host', value: 'www.modstagram.ir' }],
destination: 'https://modstagram.com/:path*',
permanent: true,
},
{
source: '/:path*',
has: [{ type: 'host', value: 'app.modstagram.ir' }],
destination: 'https://modstagram.com/:path*',
permanent: true,
},
];
},
// ۴. فقط وبلاگ — 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;