report_uploads
The 'report_uploads' directive allows NGINX to provide real-time upload progress updates to clients during file uploads.
Description
The 'report_uploads' directive is an essential feature of the NGINX upload progress tracking module that enables the reporting mechanism for upload progress to the client. When utilized, it activates HTTP responses that include progress information about the current file upload. This is beneficial for web applications that require feedback to users during file uploads, providing insights on how much of the file has been uploaded, time remaining, and other related metrics.
When configured, the directive requires one argument, which specifies the shared memory zone used for tracking upload progress. This shared memory zone stores the state of each upload, including details on the progress, errors, and completion status. To take advantage of this feature, the upload requests must include a unique identifier that links the progress reports to their respective uploads. This identifier can be passed via an HTTP GET parameter or as a header (X-Progress-ID).
The directive can be placed in the 'http', 'server', or 'location' contexts, providing flexibility in where upload tracking can be reported. It is important to ensure that the associated shared memory zone is properly defined before using this directive, as it will rely on that zone to maintain tracking data as uploads occur.
Config Example
http {
upload_progress my_zone 1m;
server {
location /upload {
track_uploads my_zone 30s;
report_uploads my_zone;
}
}
}Ensure that the shared memory zone specified in 'report_uploads' is defined and initialized with the corresponding 'upload_progress' directive.
The unique identifier for uploads must be correctly passed with each upload request; otherwise, progress cannot be tracked.
Check for potential conflicts with other directives that may handle uploads, ensuring seamless function.