update nginx config

This commit is contained in:
Zimeng Xiong
2025-11-22 21:06:01 -08:00
parent ef412a3887
commit 3835557e67
2 changed files with 38 additions and 1 deletions
+23 -1
View File
@@ -77,7 +77,13 @@ const prisma = new PrismaClient();
const PORT = process.env.PORT || 8000;
// Multer setup for file uploads
const upload = multer({ dest: uploadDir });
const upload = multer({
dest: uploadDir,
limits: {
fileSize: 50 * 1024 * 1024, // 50MB in bytes
files: 1, // Only one file per upload
},
});
app.use(
cors({
@@ -88,6 +94,22 @@ app.use(
app.use(express.json({ limit: "50mb" }));
app.use(express.urlencoded({ extended: true, limit: "50mb" }));
// Log large requests for monitoring and debugging
app.use((req, res, next) => {
const contentLength = req.headers["content-length"];
if (contentLength) {
const sizeInMB = parseInt(contentLength) / 1024 / 1024;
if (sizeInMB > 10) {
console.log(
`[LARGE REQUEST] ${req.method} ${req.path} - ${sizeInMB.toFixed(
2
)}MB - Content-Length: ${contentLength} bytes`
);
}
}
next();
});
const elementsSchema = z.array(z.object({}).passthrough());
const appStateSchema = z.object({}).passthrough();