Files
website/next.config.mjs
T

78 lines
2.5 KiB
JavaScript

import { withPayload } from '@payloadcms/next/withPayload'
import createNextIntlPlugin from 'next-intl/plugin'
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
const PUBLIC_PAGE_CACHE_CONTROL = 'public, max-age=0, s-maxage=300, stale-while-revalidate=86400'
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
reactStrictMode: true,
allowedDevOrigins: ['127.0.0.1', '192.168.1.252'],
distDir: process.env.NEXT_DIST_DIR || '.next',
images: {
formats: ['image/avif', 'image/webp'],
dangerouslyAllowSVG: true,
contentDispositionType: 'attachment',
contentSecurityPolicy: "script-src 'none'; frame-src 'none'; sandbox;",
remotePatterns: [
{ protocol: 'https', hostname: 'www.eversolo.com' },
{ protocol: 'https', hostname: 'eversolo.com' },
],
},
async redirects() {
// Legacy URL -> new URL map. Edit REDIRECTS.md for the authoritative list.
return [
// Locale entry points
{ source: '/Index/index/l/en-us.html', destination: '/en', permanent: true },
{ source: '/Index/index/l/zh-cn.html', destination: '/zh', permanent: true },
// Header / top nav
{ source: '/Product/allProduct.html', destination: '/en/products', permanent: true },
{ source: '/Support/support.html', destination: '/en/support', permanent: true },
{ source: '/Support/downloads.html', destination: '/en/downloads', permanent: true },
{ source: '/About/index.html', destination: '/en/about', permanent: true },
// Footer / secondary
{ source: '/Contact/afterservice.html', destination: '/en/support/warranty', permanent: true },
{ source: '/Contact/distributor.html', destination: '/en/where-to-buy', permanent: true },
{ source: '/Contact/oem.html', destination: '/en/support/contact', permanent: true },
]
},
async headers() {
return [
{
source: '/:locale(en|zh)',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
{
source: '/:locale(en|zh)/:path*',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
{
source: '/sitemap.xml',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
]
},
}
export default withNextIntl(withPayload(nextConfig))