Files
ipal-kit/reference/next.config.ts
T
Radosław SmolińskiandClaude Fable 5.2 b91984fbcd IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft
- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms);
  past CHANGELOG entries and the proposals in docs/dev are not rewritten
- AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames
- iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required
- env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup
- skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were
- reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-25 17:36:09 +01:00

62 lines
2.3 KiB
TypeScript

import type { NextConfig } from 'next'
import {
buildAdminCspHeaders,
buildImagesConfig,
buildSecurityHeaders,
buildUploadSecurityHeaders,
withSecurityConfig,
} from '@intecion/ipal-kit'
import { withPayload } from '@payloadcms/next/withPayload'
// @starter:if enforceCsp
// CSP enforced: the reference site is the example after the report-only phase (security.md → "ROLL OUT CSP").
const csp = { mode: 'enforce', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const
// @starter:else
//: // CSP step 1: report-only. Read the [csp] lines in the logs, add a flag or `extra` per report, then switch to
//: // mode: 'enforce' (security.md → "ROLL OUT CSP"; iapl-doctor.json silences the report-only finding until then).
//: const csp = { mode: 'report-only', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const
// @starter:endif
// Flags = what the site loads: Turnstile on forms, the analytics tools whose IDs are set in Site integrations.
const securityHeaders = buildSecurityHeaders({
csp: {
...csp,
// @starter:if analytics
analytics: true,
// @starter:endif
// @starter:if metaPixel
//: metaPixel: true,
// @starter:endif
// @starter:if linkedIn
//: linkedIn: true,
// @starter:endif
// @starter:if tiktok
//: tiktok: true,
// @starter:endif
// @starter:if clarity
//: clarity: true,
// @starter:endif
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))