Directive reference
return
Stops processing and returns a status, redirect or response body.
| Syntax | return code [text]; | return code URL; | return URL; |
|---|---|
| Contexts | serverlocationif |
| Default | none |
Behavior
Text and redirect targets may contain variables. Return runs in the rewrite phase and does not contact an upstream.
Example
location = /health {
return 200 "ok\n";
} Related directives
rewrite · error_page