restarting apache http server without interrupting http downloads
if I have large file downloads served with apache server, is there a way to restart/reload the http server(eg. with new httpd.conf update) without interrupting ongoing file downloads? or at least provide a way for clients to resume downloads?
Solution 1:
A normal download happens in a single tcp connection, there is no 'generic' way to restart apache and maintain that single connection.
BUT if you run
apachectl -k graceful
or if you send a USR1
signal to your apache master process, then it will reload gracefully, this means that it will complete serving the requests currently in progress and then reload.
On the http protocol level it is possible to request just part of a file.
The client can send a HEAD
request for the given file to the server. If the server responds with Accept-Ranges: bytes
and a Content-Length
header, the client can then proceed to send a GET
request using a Range: bytes=...
header to receive whichever part of the file it wants. The server will respond with partial content of the file and put a 206 status on its response.
Internet Explorer and Firefox are known to do this for normal downloads when you ask the browser to resume a download.