import type { NextConfig } from "next"; import { createEnv, createKriNextConfig, env } from "@kri/common/config"; const nextEnv = createEnv({ CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER), }); const nextConfig = createKriNextConfig({ async rewrites() { return [ { source: "/contact-senario/:path*", destination: `${nextEnv.CONTACT_SERVER}/contact-senario/:path*`, }, ]; }, async headers() { return [ { source: "/api/external/:path*", headers: [ { key: "Access-Control-Allow-Credentials", value: "true" }, { key: "Access-Control-Allow-Origin", value: "*" }, { key: "Access-Control-Allow-Methods", value: "GET,POST,PUT,PATCH,DELETE" }, { key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization, X-Requested-With", }, ], }, { source: "/api/list-external/:path*", headers: [ { key: "Access-Control-Allow-Origin", value: "*" }, { key: "Access-Control-Allow-Methods", value: "GET,POST,PATCH" }, { key: "Access-Control-Allow-Headers", value: "Content-Type, X-API-Key", }, ], }, ]; }, }) satisfies NextConfig; export default nextConfig;