xin

Directive reference

return

Stops processing and returns a status, redirect or response body.

Syntaxreturn code [text]; | return code URL; | return URL;
Contextsserverlocationif
Defaultnone

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