concat_types

The `concat_types` directive specifies MIME types that can be concatenated using the HTTP Concatenation module in NGINX.

Syntaxconcat_types MIME types;
Defaultnone
Contexthttp, server, location
Arguments1+

Description

The concat_types directive is used within the HTTP Concatenation module to define which MIME types are eligible for concatenation. This directive allows users to specify one or more MIME types, ensuring that only files of these types can be concatenated during an HTTP request. When enabled, a client can request multiple files in a single request using the ?? syntax followed by a comma-separated list of file paths. This is beneficial for reducing the number of HTTP requests for web resources, potentially improving load times and reducing server load.

The directive can take one or more MIME type arguments and can be configured in http, server, or location contexts. By default, it supports common types such as text/css for CSS files and application/javascript for JavaScript files. The types specified must match the MIME types of the resources being requested; otherwise, those requests will be ignored, and a standard response for the individual files will be returned. This behavior is particularly useful for environments where file types vary and need to be carefully managed to avoid issues with concatenation.

If not configured correctly, or if the wrong MIME types are specified, users may encounter situations where the concatenation fails, and requested files are served individually instead. Thus, it is important to ensure that the files being served not only align with the specified MIME types but also fit within any other parameters defined by the concatenation module, such as maximum file limits and delimiter specifications.

Config Example

location /static/ {
    concat on;
    concat_types application/javascript text/css;
}

Ensure that only the intended MIME types are specified to avoid serving unwanted file types.

Check that the files being concatenated match the defined MIME types or concatenation may fail.

Be aware that exceeding system limits on request sizes may require tuning buffer settings based on your environment.

← Back to all directives