gendesign/frontend/next.config.ts

50 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
},
];
},
// Markdown в public/docs/ — отдаём с text/markdown + charset, чтобы
// браузер показывал inline (не download).
async headers() {
return [
{
source: "/docs/:path*.md",
headers: [
{ key: "Content-Type", value: "text/markdown; charset=utf-8" },
],
},
];
},
};
export default nextConfig;