mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-30 20:39:55 +00:00
Next.js 15 accepts proxyClientMaxBodySize at runtime but TypeScript types for ExperimentalConfig don't include it yet, causing build failures. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Enable standalone output for optimized Docker deployment
|
|
output: "standalone",
|
|
|
|
// Experimental features
|
|
// Type assertion needed: proxyClientMaxBodySize is valid in Next.js 15 but types lag behind
|
|
experimental: {
|
|
// Increase proxy body size limit for file uploads (default is 10MB)
|
|
// This allows larger files to be uploaded through the /api/* rewrite proxy to FastAPI
|
|
proxyClientMaxBodySize: '100mb',
|
|
} as NextConfig['experimental'],
|
|
|
|
// API Rewrites: Proxy /api/* requests to FastAPI backend
|
|
// This simplifies reverse proxy configuration - users only need to proxy to port 8502
|
|
// Next.js handles internal routing to the API backend on port 5055
|
|
async rewrites() {
|
|
// INTERNAL_API_URL: Where Next.js server-side should proxy API requests
|
|
// Default: http://localhost:5055 (single-container deployment)
|
|
// Override for multi-container: INTERNAL_API_URL=http://api-service:5055
|
|
const internalApiUrl = process.env.INTERNAL_API_URL || 'http://localhost:5055'
|
|
|
|
console.log(`[Next.js Rewrites] Proxying /api/* to ${internalApiUrl}/api/*`)
|
|
|
|
return [
|
|
{
|
|
source: '/api/:path*',
|
|
destination: `${internalApiUrl}/api/:path*`,
|
|
},
|
|
]
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|