feat: payload cms
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Failing after 1m13s
Build & Deploy / 🏗️ Build (push) Failing after 5m53s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Failing after 1m13s
Build & Deploy / 🏗️ Build (push) Failing after 5m53s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
This commit is contained in:
135
next.config.mjs
135
next.config.mjs
@@ -2,8 +2,9 @@ import withMintelConfig from '@mintel/next-config';
|
||||
import withBundleAnalyzer from '@next/bundle-analyzer';
|
||||
import { withSentryConfig } from '@sentry/nextjs';
|
||||
|
||||
console.log('🚀 NEXT CONFIG LOADED FROM:', process.cwd());
|
||||
import { withPayload } from '@payloadcms/next/withPayload';
|
||||
|
||||
console.log('🚀 NEXT CONFIG LOADED FROM:', process.cwd());
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
onDemandEntries: {
|
||||
@@ -11,9 +12,10 @@ const nextConfig = {
|
||||
maxInactiveAge: 60 * 1000,
|
||||
},
|
||||
experimental: {
|
||||
optimizeCss: true,
|
||||
optimizePackageImports: ['lucide-react', 'framer-motion', '@/components/ui'],
|
||||
},
|
||||
swcMinify: false,
|
||||
reactStrictMode: false,
|
||||
productionBrowserSourceMaps: false,
|
||||
logging: {
|
||||
fetches: {
|
||||
@@ -22,55 +24,68 @@ const nextConfig = {
|
||||
},
|
||||
output: 'standalone',
|
||||
async headers() {
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
const umamiDomain = new URL(process.env.UMAMI_API_ENDPOINT || 'https://analytics.infra.mintel.me').origin;
|
||||
const directusDomain = new URL(process.env.DIRECTUS_URL || 'https://cms.klz-cables.com').origin;
|
||||
const imgproxyDomain = new URL(process.env.IMGPROXY_URL || 'http://klz-imgproxy:8080').origin;
|
||||
const glitchtipDomain = new URL(process.env.SENTRY_DSN ? new URL(process.env.SENTRY_DSN).origin : 'https://errors.infra.mintel.me').origin;
|
||||
// Additional domains that need to be whitelisted for images
|
||||
const extraImgDomains = [
|
||||
'https://klz-cables.com',
|
||||
'https://staging.klz-cables.com',
|
||||
'https://testing.klz-cables.com',
|
||||
'http://klz.localhost',
|
||||
'https://www.gravatar.com',
|
||||
'https://gravatar.com',
|
||||
].join(' ');
|
||||
|
||||
const cspHeader = `
|
||||
default-src 'self';
|
||||
script-src 'self' 'unsafe-inline' 'unsafe-eval' ${umamiDomain};
|
||||
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
|
||||
font-src 'self' https://fonts.gstatic.com;
|
||||
img-src 'self' data: blob: ${imgproxyDomain} ${directusDomain};
|
||||
connect-src 'self' ${umamiDomain} ${glitchtipDomain} ${directusDomain};
|
||||
img-src 'self' data: blob: ${extraImgDomains};
|
||||
connect-src 'self' ${umamiDomain} ${glitchtipDomain};
|
||||
frame-src 'self';
|
||||
object-src 'none';
|
||||
base-uri 'self';
|
||||
form-action 'self';
|
||||
frame-ancestors 'none';
|
||||
upgrade-insecure-requests;
|
||||
${isProd ? 'upgrade-insecure-requests;' : ''}
|
||||
`.replace(/\s{2,}/g, ' ').trim();
|
||||
|
||||
const secureHeaders = [
|
||||
{
|
||||
key: 'Content-Security-Policy',
|
||||
value: cspHeader,
|
||||
},
|
||||
{
|
||||
key: 'X-Frame-Options',
|
||||
value: 'DENY',
|
||||
},
|
||||
{
|
||||
key: 'X-Content-Type-Options',
|
||||
value: 'nosniff',
|
||||
},
|
||||
{
|
||||
key: 'Referrer-Policy',
|
||||
value: 'strict-origin-when-cross-origin',
|
||||
},
|
||||
{
|
||||
key: 'Permissions-Policy',
|
||||
value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()',
|
||||
},
|
||||
];
|
||||
|
||||
if (isProd) {
|
||||
secureHeaders.push({
|
||||
key: 'Strict-Transport-Security',
|
||||
value: 'max-age=63072000; includeSubDomains; preload',
|
||||
});
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
source: '/:path*',
|
||||
headers: [
|
||||
{
|
||||
key: 'Content-Security-Policy',
|
||||
value: cspHeader,
|
||||
},
|
||||
{
|
||||
key: 'Strict-Transport-Security',
|
||||
value: 'max-age=63072000; includeSubDomains; preload',
|
||||
},
|
||||
{
|
||||
key: 'X-Frame-Options',
|
||||
value: 'DENY',
|
||||
},
|
||||
{
|
||||
key: 'X-Content-Type-Options',
|
||||
value: 'nosniff',
|
||||
},
|
||||
{
|
||||
key: 'Referrer-Policy',
|
||||
value: 'strict-origin-when-cross-origin',
|
||||
},
|
||||
{
|
||||
key: 'Permissions-Policy',
|
||||
value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()',
|
||||
},
|
||||
],
|
||||
headers: secureHeaders,
|
||||
},
|
||||
];
|
||||
},
|
||||
@@ -373,33 +388,31 @@ const nextConfig = {
|
||||
source: '/vcf/michael-bodemer',
|
||||
destination: '/michael-bodemer.vcf',
|
||||
permanent: true,
|
||||
},
|
||||
}
|
||||
];
|
||||
},
|
||||
images: {
|
||||
loader: 'custom',
|
||||
loaderFile: './lib/imgproxy-loader.ts',
|
||||
dangerouslyAllowSVG: true,
|
||||
contentDispositionType: "attachment",
|
||||
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
|
||||
formats: ['image/webp'],
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: 'klz-cables.com',
|
||||
},
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: '*.klz-cables.com',
|
||||
},
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'klz.localhost',
|
||||
},
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
},
|
||||
],
|
||||
},
|
||||
async rewrites() {
|
||||
const umamiUrl =
|
||||
process.env.UMAMI_API_ENDPOINT ||
|
||||
process.env.UMAMI_SCRIPT_URL ||
|
||||
process.env.NEXT_PUBLIC_UMAMI_SCRIPT_URL ||
|
||||
'https://analytics.infra.mintel.me';
|
||||
const glitchtipUrl = process.env.SENTRY_DSN
|
||||
? new URL(process.env.SENTRY_DSN).origin
|
||||
: 'https://errors.infra.mintel.me';
|
||||
|
||||
const directusUrl = process.env.INTERNAL_DIRECTUS_URL || process.env.DIRECTUS_URL || 'https://cms.klz-cables.com';
|
||||
|
||||
let imgproxyUrl = process.env.IMGPROXY_URL || 'http://klz-imgproxy:8080';
|
||||
if (!imgproxyUrl.startsWith('http')) {
|
||||
imgproxyUrl = `https://${imgproxyUrl}`;
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
source: '/de/produkte',
|
||||
@@ -409,14 +422,6 @@ const nextConfig = {
|
||||
source: '/de/produkte/:path*',
|
||||
destination: '/de/products/:path*',
|
||||
},
|
||||
{
|
||||
source: '/cms/:path*',
|
||||
destination: `${directusUrl}/:path*`,
|
||||
},
|
||||
{
|
||||
source: '/_img/:path*',
|
||||
destination: `${imgproxyUrl}/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
@@ -425,6 +430,6 @@ const withAnalyzer = withBundleAnalyzer({
|
||||
enabled: process.env.ANALYZE === 'true',
|
||||
});
|
||||
|
||||
export default withAnalyzer(withMintelConfig(nextConfig, {
|
||||
export default withPayload(withAnalyzer(withMintelConfig(nextConfig, {
|
||||
hideSourceMaps: true,
|
||||
}));
|
||||
})));
|
||||
|
||||
Reference in New Issue
Block a user