Raise report upload request size limits

- Configure NestJS with an explicit JSON and urlencoded body parser limit controlled by API_BODY_LIMIT.

- Set the default API body limit to 100mb for report HTML, key frames, template images, and Data URL file uploads.

- Add a matching Nginx client_max_body_size 100m limit so Docker web proxy no longer rejects large report saves first.

- Document the new request body limit in README, deployment docs, progress notes, environment example, and AGENTS context.

- Rebuild and verify Docker web/api with a large report save through the Nginx /api proxy.
This commit is contained in:
2026-05-02 03:29:46 +08:00
parent 285dbd2023
commit 2a86d9f5e4
8 changed files with 16 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import 'reflect-metadata';
import { NestFactory } from '@nestjs/core';
import cookieParser from 'cookie-parser';
import { json, urlencoded } from 'express';
import session from 'express-session';
import { AppModule } from './app.module.js';
import { AuthService } from './auth/auth.service.js';
@@ -11,10 +12,13 @@ import { attachSpeechProxy } from './speech/speech.gateway.js';
import { SpeechService } from './speech/speech.service.js';
const bootstrap = async () => {
const app = await NestFactory.create(AppModule);
const app = await NestFactory.create(AppModule, { bodyParser: false });
const port = Number(process.env.API_PORT ?? 3100);
const bodyLimit = process.env.API_BODY_LIMIT ?? '100mb';
app.setGlobalPrefix('api');
app.use(json({ limit: bodyLimit }));
app.use(urlencoded({ extended: true, limit: bodyLimit }));
app.useGlobalFilters(new ApiExceptionFilter());
app.enableCors({
origin: process.env.CORS_ORIGIN?.split(',') ?? ['http://localhost:3001', 'http://localhost:4002'],