echo_duplicate

The `echo_duplicate` directive outputs the specified string multiple times to the response.

语法echo_duplicate string1 string2 ...;"`,` the result will be one or more occurrences of the input strings continuously outputted in the response. This is particularly useful for generating test responses that feature repeated strings without needing to call the directive multiple times separately. Since the directive does not automatically append new lines, presentational requirements in the output should be accounted for in the input strings. It is also important to ensure proper argument structure; each provided argument must be encapsulated adequately to avoid processing errors, especially when strings are intended to contain spaces or special characters. The directive's output is determined by its argument input directly, without any additional changes applied to those strings.
默认值none
上下文location, if in location
参数2+

说明

The echo_duplicate directive from the NGINX Echo module allows you to send a string output multiple times in a response. This directive can accept two or more arguments, where each argument must be a string specifying the content to be echoed. The directive processes these strings and appends each to the output, effectively duplicating the provided strings in the response body.

When configured within a location or if in location block, the echo_duplicate directive is executed during the request processing phase, and it directly writes to the response based on NGINX's internal event loop. For instance, if you specify `echo_duplicate

配置示例

location /duplicate {
    echo_duplicate "This is repeated!" "And again!";
}

Make sure to provide at least two arguments, as the directive requires a minimum of two strings for duplication.

Ensure that string arguments are properly quoted if they contain spaces or special characters.

The output will not add line breaks by default unless explicitly included in the strings.

← 返回所有指令