mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(download): ask reverse proxies not to buffer file downloads (#604)
Send X-Accel-Buffering: no on file download responses so nginx and compatible reverse proxies stream them through instead of buffering, the usual cause of a self-hosted download that "starts but never finishes". The app already delivers exactly Content-Length bytes; a new real-socket test proves it for both the collated PDF and the multi-file ZIP. Refs #590
This commit is contained in:
@@ -120,6 +120,11 @@ export async function fileRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Check Range header before setting content headers (a 416 must not
|
||||
// carry the attachment Content-Type that would confuse serialization).
|
||||
reply.header("Accept-Ranges", "bytes");
|
||||
// Tell nginx (and compatible reverse proxies) not to buffer the download.
|
||||
// A buffering proxy in front of a self-hosted install is the usual cause
|
||||
// of a download that "starts but never finishes"; the app itself always
|
||||
// delivers exactly Content-Length bytes. Mirrors the SSE route (#590).
|
||||
reply.header("X-Accel-Buffering", "no");
|
||||
|
||||
const range = request.headers.range;
|
||||
if (range) {
|
||||
|
||||
Reference in New Issue
Block a user