From a1d8ee292a38820487cebf8d1f1c49875165a2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Tue, 21 Apr 2026 07:37:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E6=95=88=E7=9A=84=20headers=20=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=A4=B4=E5=B7=B2=E5=9C=A8=20nginx=20?= =?UTF-8?q?=E4=B8=AD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.ts | 94 +++----------------------------------------------- 1 file changed, 4 insertions(+), 90 deletions(-) diff --git a/next.config.ts b/next.config.ts index 73129b4..53844dc 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,109 +1,23 @@ import type { NextConfig } from "next"; -const isDev = process.env.NODE_ENV === 'development'; const cdnDomain = process.env.CDN_DOMAIN || ''; const nextConfig: NextConfig = { distDir: 'dist', - output: 'standalone', - assetPrefix: isDev ? undefined : cdnDomain, + output: 'export', + assetPrefix: cdnDomain || undefined, images: { - remotePatterns: [ - { - protocol: 'https', - hostname: '**', - }, - ], - formats: ['image/avif', 'image/webp'], - deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], - imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], - dangerouslyAllowSVG: true, - contentDispositionType: 'attachment', - contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;", - minimumCacheTTL: 60, - unoptimized: !isDev, + unoptimized: true, }, compress: true, poweredByHeader: false, reactStrictMode: true, - reactProductionProfiling: !isDev, experimental: { optimizePackageImports: ['lucide-react'], }, compiler: { removeConsole: process.env.NODE_ENV === 'production', }, - headers: async () => { - return [ - { - source: '/:path*', - 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=()' - }, - ], - }, - { - source: '/:all*(svg|jpg|jpeg|png|gif|webp|avif)', - locale: false, - headers: [ - { - key: 'Cache-Control', - value: 'public, max-age=31536000, immutable', - }, - ], - }, - { - source: '/_next/static/:all*', - locale: false, - headers: [ - { - key: 'Cache-Control', - value: 'public, max-age=31536000, immutable', - }, - ], - }, - { - source: '/fonts/:all*', - locale: false, - headers: [ - { - key: 'Cache-Control', - value: 'public, max-age=31536000, immutable', - }, - { - key: 'Access-Control-Allow-Origin', - value: '*', - }, - ], - }, - ]; - }, }; -export default nextConfig; \ No newline at end of file +export default nextConfig;