Files
laadpalenviewer/webapp/next.config.ts
T
Robbert JanssenandClaude Opus 4.8 ab9ed8abb8 Initial commit: Laadpalenviewer
Static-generation EV charging map for the Netherlands with two layers
(passenger / logistics-freight), per-municipality crop-outs, and
gemeente + province boundaries from PDOK/CBS.

- data-pipeline/ (Node/TS): NDW OCPI download + classify (freight >=350kW /
  MCS / megawatt / Milence,WattHub) + external sources (curated, OCM, EAFO)
  + PDOK CBS boundaries -> static GeoJSON/JSON.
- webapp/ (Next.js 16 + React 19 + deck.gl + MapLibre): national view loads
  all points without details; selecting a gemeente eagerly loads its detail
  bundle (OCPI EVSE/connector/tariff + status) for instant marker clicks.
  Passenger colored by OCPI status (fleetsim-style), freight amber/megawatt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 15:26:56 +02:00

72 lines
2.3 KiB
TypeScript

import type { NextConfig } from "next";
// Basemap (CartoDB Positron via MapLibre) hosts used by the client.
const MAP_TILE_HOSTS = "https://basemaps.cartocdn.com https://*.basemaps.cartocdn.com";
const nextConfig: NextConfig = {
compress: true,
async headers() {
const securityHeaders = [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-XSS-Protection", value: "1; mode=block" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
];
const csp = (frameAncestors: string) =>
[
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://va.vercel-scripts.com",
"style-src 'self' 'unsafe-inline'",
`img-src 'self' data: blob: https://logo.clearbit.com ${MAP_TILE_HOSTS}`,
"font-src 'self' data:",
`connect-src 'self' https://va.vercel-scripts.com ${MAP_TILE_HOSTS}`,
"worker-src 'self' blob:",
"child-src 'self' blob:",
`frame-ancestors ${frameAncestors}`,
].join("; ");
return [
{
source: "/embed",
headers: [
...securityHeaders,
{ key: "Content-Security-Policy", value: csp("*") },
],
},
{
source: "/((?!embed).*)",
headers: [
...securityHeaders,
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Content-Security-Policy", value: csp("'none'") },
],
},
{
// Crop-out + national GeoJSON: cache 1 hour.
source: "/data/:path*.geojson",
headers: [
{ key: "Cache-Control", value: "public, max-age=3600, must-revalidate" },
{ key: "Content-Type", value: "application/geo+json" },
],
},
{
// Per-gemeente detail bundles: cache 1 hour + SWR.
source: "/data/:path*.json",
headers: [
{ key: "Cache-Control", value: "public, max-age=3600, stale-while-revalidate=86400" },
],
},
{
source: "/municipalities.json",
headers: [
{ key: "Cache-Control", value: "public, max-age=86400, stale-while-revalidate=3600" },
],
},
];
},
};
export default nextConfig;