fix: stop cutting off uploads over 10 MB that pass through the server, such as office documents saved from the editor

This commit is contained in:
Linus Rath
2026-10-14 04:17:51 +02:00
parent 60257bb732
commit 31205e44d8
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ import { DisallowedUrlError, fetchPublicUrl } from '@/lib/security/url-guard';
import { authHeaderFor, credentialOrigin, privateProxyOrigins, type CredentialInject, type CredentialSpec } from './credentials';
import { getUserCredential, setUserCredentialSecret, userKey, type VaultUser } from './vault';
/** Largest request body the proxy forwards (one upload chunk). */
export const MAX_PROXY_REQUEST_BYTES = 512 * 1024 * 1024;
/** Largest request body the proxy forwards (one upload chunk); see proxyClientMaxBodySize in next.config.ts. */
export const MAX_PROXY_REQUEST_BYTES = 100 * 1024 * 1024;
/** Largest response body it passes back (a download). */
export const MAX_PROXY_RESPONSE_BYTES = 2 * 1024 * 1024 * 1024;
/** Largest response it reads to capture a secret from. */
+8
View File
@@ -59,6 +59,14 @@ const nextConfig: NextConfig = {
// it from node_modules at runtime instead of trying to bundle it. Used by
// PLUGIN_DEV_DIR's on-the-fly bundler.
serverExternalPackages: ["esbuild"],
experimental: {
// proxy.ts runs for every request, /api included, and Next buffers the
// body for it up to this size and silently cuts off the rest. 10 MB (the
// default) truncated WOPI saves and WebDAV uploads of bigger files, and
// plugin uploads through /api/plugin-proxy. Keep MAX_PROXY_REQUEST_BYTES
// in lib/plugin-secrets/proxy.ts in step with it.
proxyClientMaxBodySize: "100mb",
},
// Response headers are the host's job in a static export (see out/_headers).
...(isLite
? {}