gendesign/frontend/next.config.ts

38 lines
1.2 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
reactStrictMode: true,
output: "standalone",
images: {
remotePatterns: [
{ protocol: "https", hostname: "xn--80az8a.xn--d1aqf.xn--p1ai" },
{ protocol: "https", hostname: "наш.дом.рф" },
],
formats: ["image/webp"],
minimumCacheTTL: 60 * 60 * 24 * 7,
},
// In dev (no Caddy) Next.js itself proxies /api/* and /health to the backend
// so the browser can use same-origin relative URLs.
// In prod Caddy intercepts these paths before they reach Next.js,
// so these rewrites are effectively a no-op there.
async rewrites() {
const backend = process.env.BACKEND_URL ?? "http://localhost:8000";
return [
{ source: "/api/:path*", destination: `${backend}/api/:path*` },
{ source: "/health", destination: `${backend}/health` },
];
},
// /sf — короткий алиас для /site-finder (legacy short URL).
async redirects() {
return [
{ source: "/sf", destination: "/site-finder", permanent: true },
{
source: "/sf/:path*",
destination: "/site-finder/:path*",
permanent: true,
},
];
},
};
export default nextConfig;