ssi_types
The 'ssi_types' directive in NGINX specifies the media types of files that should be processed for Server Side Includes (SSI).
Description
The 'ssi_types' directive is used to define which file types are eligible for Server Side Includes (SSI) processing in NGINX. By default, only HTML and SHTML files undergo SSI processing to avoid unnecessary parsing of other file types that do not require it. This directive allows users to extend the set of file types, ensuring that any file type specified can include SSI commands. The directive accepts one or more MIME types as its argument and is configured in http, server, or location contexts. For example, you can add types like 'text/xml' or 'application/json' if you want to include SSI in those types of files.
When the NGINX server encounters a file that has an associated MIME type specified in the 'ssi_types', it will process that file for SSI directives. The directive is particularly useful in dynamic web applications where various formats may need to contain include commands. However, care should be taken when extending SSI to non-HTML types, as this can potentially increase the server's processing load by parsing files that might not require SSI. Moreover, proper content negotiation should be observed to ensure that the correct types are served and processed appropriately.
Config Example
location /includes {
ssi on;
ssi_types text/xml application/json;
}Make sure to include the desired MIME types correctly; a typo will prevent processing.
Remember that enabling SSI for many file types can increase server load and response times.
Do not forget to enable SSI in the location block or globally for it to take effect.