import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  reactStrictMode: false, // Desabilitar StrictMode para evitar double render que causa removeChild
  experimental: {
    externalDir: true,
    // Aumentar limite para upload de logos (Server Actions)
    serverActions: {
      bodySizeLimit: '10mb',
    },
  },
  async rewrites() {
    return {
      beforeFiles: [
        {
          source: "/api/:path*",
          destination: "http://backend:8080/api/:path*",
        },
      ],
    };
  },
  headers: async () => {
    return [
      {
        source: "/api/:path*",
        headers: [
          {
            key: "X-Forwarded-For",
            value: "127.0.0.1",
          },
          {
            key: "X-Forwarded-Host",
            value: "${host}",
          },
        ],
      },
    ];
  },
};

export default nextConfig;
