echo_end

The `echo_end` directive terminates the processing of commands within an echo context.

Syntaxecho_end;
Defaultnone
Contextlocation, if in location
Argumentsnone

Description

The echo_end directive is part of the NGINX Echo module, which provides various commands to manipulate HTTP requests and responses. When echo_end is encountered within a location or a conditional context, it signals the end of processing for any subsequent echo commands in that block. This is particularly useful for cases where you want to halt execution under certain conditions or to improve clarity by explicitly signaling that no further directives should be processed after this point.

In practice, the use of echo_end can be very strategic. For example, in scenarios with conditional logic, placing echo_end helps ensure that once certain responses or outputs have been handled, further processing does not continue, thus producing cleaner, more readable configurations. In addition, it can enhance performance by preventing unnecessary command evaluations after a certain output has been generated.

Since this directive does not take any parameters and has no default value, it is straightforward to use. Simply including echo_end; in the appropriate location in your NGINX configuration will effectively accomplish this command's purpose without complexities or additional configurations.

Config Example

location /test {
    echo "This will be processed";
    echo_end;
    echo "This will not be processed";
}

Forgetting to include echo_end; can lead to unintended command execution after the desired output.

echo_end must be used within a location or if context, else it will lead to configuration errors.

← Back to all directives