upload_resumable
The `upload_resumable` directive enables resumable uploads in NGINX, allowing clients to resume interrupted file uploads.
Description
The upload_resumable directive is a part of the NGINX upload module that allows for handling multipart/form-data file uploads with support for resuming uploads. When set to 'on', this directive allows clients to send fragmented uploads and provides the capability to resume the upload of a file from a specific byte range if the upload is interrupted. This is particularly useful for large file transfers over unreliable networks where interruptions can occur frequently. When resuming, the server can validate the existing file and accept the next chunks of data rather than requiring the entire file to be uploaded again.
This directive works by interpreting the Content-Range or X-Content-Range headers sent by the clients, which inform the server about the range of bytes being uploaded. Consequently, the server is able to merge the incoming data with existing data in the destination storage. The directive can be applied at various contexts such as http, server, and location, thus providing flexibility in configuring upload behavior based on application requirements.
The setting can be enabled globally or for specific locations, allowing granular control of upload behaviors for different routes. If this directive is set to 'off', resumable uploads will not be allowed, and any interrupted uploads will need to be restarted from the beginning.
Config Example
server {
listen 80;
server_name example.com;
location /upload {
upload_pass /upload_handler;
upload_store /tmp/uploads;
upload_resumable on;
}
}Ensure appropriate client support for resumable uploads, as not all clients may handle Content-Range headers correctly.
Incomplete uploads might not be accepted correctly if misconfigured, leading to data loss or corruption.
When switching from 'off' to 'on', ensure existing file handling practices align with resumable strategies.