track_uploads

The `track_uploads` directive enables tracking of upload progress for POST requests in a specified location using a shared memory zone.

Syntaxtrack_uploads ;
Defaultnone
Contexthttp, server, location
Arguments2

Description

The track_uploads directive is utilized to monitor ongoing uploads to an NGINX server. It effectively registers every POST request landing in the defined context (http, server, or location) and allows NGINX to track the progress of these uploads in real-time. To operate, this directive requires two parameters: the name of an existing shared memory zone (created with the upload_progress directive), and a timeout duration that dictates how long to retain upload progress information. During the upload process, NGINX stores tracking data, including the amount of data uploaded, in the specified zone_name, enabling the monitoring of the upload status through a unique identifier sent with each request. This progress can subsequently be reported back to the client in various formats such as JSON or JavaScript Object Notation (JSONP).

By registering uploads within a dedicated shared memory zone, multiple concurrent uploads can be managed efficiently. The timeout parameter determines the duration for which tracking information should be preserved after the upload's completion. If a given entry exceeds this timeout, it is removed from tracking, making way for new uploads and preventing excessive memory consumption. The user should be cautious when configuring the timeout to ensure they have sufficient resources to handle the expected traffic and do not prematurely clean up an active upload track.

Config Example

location /upload {
    upload_progress uploads 1m;
    track_uploads uploads 30s;
}

Ensure that the specified <zone_name> has been defined using the upload_progress directive beforehand, or tracking will not function.

Make sure to set an appropriate timeout based on your application's performance characteristics to avoid premature removal of tracking data.

In case of high traffic, monitor memory usage, as each upload track consumes shared memory resources.

← Back to all directives