reference/ is one complete client site on the plugin (made-up company, pl/en, MongoDB, every library block and template, token standard light/dark, forms, consent, SEO/GEO, enforced CSP, 2FA, base + demo seeds, Coolify runbook, smoke tests). It uses the plugin as file:.. (injected) and is not shipped. - docs/agent/reference-site/INDEX.md (generated by scripts/reference-index.mjs, kept current by test/referenceIndex.test.ts) - AGENT.md section and pointers in ipal-site, ipal-setup, ipal-reference, ipal-upgrade, ipal-block; release steps in PROGRAMISTA §8.1b - CI: reference (fast) on every push, reference-full on main; doctor steps wired, commented until ipal-doctor ships Co-Authored-By: Claude Opus 5.5 <[email protected]>
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import type { NextConfig } from 'next'
|
|
|
|
import {
|
|
buildAdminCspHeaders,
|
|
buildImagesConfig,
|
|
buildSecurityHeaders,
|
|
buildUploadSecurityHeaders,
|
|
withSecurityConfig,
|
|
} from '@intecion/ipal-kit'
|
|
import { withPayload } from '@payloadcms/next/withPayload'
|
|
|
|
// CSP enforced: the reference site is the example after the report-only phase (security.md → "ROLL OUT CSP").
|
|
// Flags = what the site loads: Turnstile on forms, Google analytics/GTM when IDs are set in Site integrations.
|
|
const csp = { mode: 'enforce', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const
|
|
|
|
const securityHeaders = buildSecurityHeaders({
|
|
csp: { ...csp, analytics: true, turnstile: true },
|
|
hsts: process.env.NODE_ENV === 'production',
|
|
})
|
|
|
|
const nextConfig: NextConfig = {
|
|
// ALLOW_LOCAL_MEDIA=1 (local / CI production checks only): let next/image optimize files the app serves on localhost
|
|
images: buildImagesConfig(process.env.ALLOW_LOCAL_MEDIA === '1' ? { production: false } : {}),
|
|
// Metadata in <head> for crawlers (deployment.md §3a)
|
|
htmlLimitedBots:
|
|
/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Yandex|DuckDuckBot|Baiduspider|Screaming Frog|AhrefsBot|SemrushBot/i,
|
|
async headers() {
|
|
return [
|
|
{ source: '/:path*', headers: securityHeaders },
|
|
{ source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, // after the site-wide rule
|
|
...buildUploadSecurityHeaders(),
|
|
]
|
|
},
|
|
}
|
|
|
|
// withSecurityConfig: no X-Powered-By (Next's and Payload's)
|
|
export default withPayload(withSecurityConfig(nextConfig))
|