concat_delimiter

The `concat_delimiter` directive sets the string that separates concatenated files in HTTP responses.

Syntaxconcat_delimiter delimiter_string;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The concat_delimiter directive is part of the HTTP Concatenation module for NGINX, allowing user-defined delimiters to be specified between concatenated files in the response. This directive takes a single string argument that serves as the delimiter when multiple resources, like JavaScript or CSS files, are concatenated into a single HTTP response. Utilizing this directive helps in structuring the output more clearly, particularly useful when clients expect specific formatting to parse the combined output effectively.

You can apply the concat_delimiter directive within the http, server, or location contexts, enabling flexibility in configuration. When the directive is set, every time files are concatenated during a request, the specified delimiter will be inserted between the respective file contents. For example, if your delimiter is set to a semicolon, the response will include semicolons separating the concatenated files rather than the default behavior of just concatenating the files directly. This becomes particularly useful in debugging scenarios or when handling mime types that may require specific delimiters for proper parsing on the client-side.

Config Example

location /static/js/ {
    concat on;
    concat_delimiter ';';
}

Ensure the chosen delimiter does not conflict with the content of the files being concatenated, as this could lead to parsing errors on the client side.

The delimiter should be carefully selected based on the file types to avoid breaking functionality, especially with JavaScript and CSS files.

← Back to all directives