Files
iddaai-fe/next.config.ts
fahricansecer 5c8619b282
Deploy Iddaai Frontend / build-and-deploy (push) Failing after 34s
gg
2026-05-10 22:59:27 +03:00

49 lines
1.2 KiB
TypeScript

import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
const nextConfig: NextConfig = {
output: "standalone",
experimental: {
optimizePackageImports: ["@chakra-ui/react"],
},
reactCompiler: true,
async headers() {
return [
{
source: "/(.*)",
headers: [
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains",
},
],
},
];
},
async rewrites() {
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
if (!apiUrl) {
throw new Error("url is not defined");
}
// Remove the trailing /api to map uploads from the base backend url
const backendUrl = apiUrl.replace(/\/api\/?$/, "");
return [
{
source: "/api/backend/:path*",
destination: `${apiUrl}/:path*`,
},
{
source: "/uploads/:path*",
destination: `${backendUrl}/uploads/:path*`,
},
];
},
};
const withNextIntl = createNextIntlPlugin();
export default withNextIntl(nextConfig);