File Handler is used for returning a file from web server. It is loaded by Index Controller when a request is made to a file that has an extension that has not already been served by another Handler (such as Resource and Image Handler). File Handler is usually considered for returning documents, videos and audio from the web server. It also allows to return a file within a byte range, like in the case of file streams.
This script can only be executed through Index Gateway and it throws a 403 Forbidden message if accessed directly.
File Handler analyzes the request string and determines what type of file is being requested. It also checks if byte range is requested from the response rather than the whole file.
File Handler tells the user agent to use cache, if the system detects that the user agent already has the file that is the latest.
File Handler analyzes the file contents on the server to determine what type of file is requested. If this is not possible, then it determines the file type based on file extension and uses that as a header that will return the content to the user agent.
File Handler applies all appropriate headers to the returned file, from cache control to last modified timestamps and robots tags, latter of which is based on configuration.
Handler returns either the whole content or byte range of the content, if such was requested, to the user agent, if the file was found.
File Handler also makes an entry in the log file about the request, if Logger is used.