cms.c2sgmbh/next.config.mjs
Martin Porwoll 06999b2bd7 fix: add allowedOrigins for Next.js server actions behind reverse proxy
Next.js has its own CSRF protection for server actions, separate from
Payload's csrf config. Without allowedOrigins, server actions from the
admin panel behind a reverse proxy are rejected because the Origin header
(cms.c2sgmbh.de) doesn't match the Host header (localhost:3001).

Also removes temporary debug logging from multiTenant access check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:02:03 +00:00

31 lines
850 B
JavaScript

import { withPayload } from '@payloadcms/next/withPayload'
/** @type {import('next').NextConfig} */
const nextConfig = {
// Reduce memory usage during build
experimental: {
// Use fewer workers for builds on low-memory systems
workerThreads: false,
cpus: 1,
// Allow server actions from these origins (behind reverse proxy)
serverActions: {
allowedOrigins: [
'pl.porwoll.tech',
'pl.c2sgmbh.de',
'cms.c2sgmbh.de',
],
},
},
// Webpack configuration for TypeScript/ESM compatibility
webpack: (webpackConfig) => {
webpackConfig.resolve.extensionAlias = {
'.cjs': ['.cts', '.cjs'],
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.mjs': ['.mts', '.mjs'],
}
return webpackConfig
},
}
export default withPayload(nextConfig, { devBundleServerPackages: false })