Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : Valo-Plex8 * File : next.config.ts9 * Repository : https://git.spboucher.ai/valo-plex10 * Project Website : https://www.valo-plex.com11 * Created : 2026-12-0112 * Last Modified : 2026-12-0113 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142import type { NextConfig } from "next";43import { withKaMaps } from "@ka/maps/next";4445// Préproduction (VX_PREPROD=1) : rien n'est indexé.46const PREPROD = process.env.VX_PREPROD === "1";47// Cartes : KA Maps, notre moteur (WebAssembly, worker de même origine) et nos services. Aucun hôte tiers.48const KA_MAPS = ["https://tiles.spboucher.ai", "https://terrain.spboucher.ai", "https://geo.spboucher.ai", "https://maps.spboucher.ai"];4950const csp = [51 "default-src 'self'",52 "script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'",53 "style-src 'self' 'unsafe-inline'",54 "img-src 'self' data: https:",55 "font-src 'self' data:",56 `connect-src 'self' ${KA_MAPS.join(" ")}`,57 "worker-src 'self'",58 "child-src 'self'",59 "frame-ancestors 'none'",60 "base-uri 'self'",61 "form-action 'self'",62].join("; ");6364const nextConfig: NextConfig = {65 serverExternalPackages: ["better-sqlite3"],66 poweredByHeader: false,67 async headers() {68 return [69 {70 source: "/apk/:fichier*",71 headers: [72 { key: "Content-Type", value: "application/vnd.android.package-archive" },73 { key: "Content-Disposition", value: "attachment" },74 { key: "Cache-Control", value: "public, max-age=3600" },75 ],76 },77 {78 source: "/:path*",79 headers: [80 { key: "Content-Security-Policy", value: csp },81 { key: "X-Content-Type-Options", value: "nosniff" },82 { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },83 { key: "X-Frame-Options", value: "DENY" },84 { key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" },85 { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },86 ...(PREPROD ? [{ key: "X-Robots-Tag", value: "noindex, nofollow, noarchive" }] : []),87 ],88 },89 ];90 },91};9293// withKaMaps copie les actifs du moteur dans public/ka-maps/<version>/ et pose leurs en-têtes (wasm, cache immuable).94export default withKaMaps(nextConfig);95