Syntax: | return return return |
---|---|
Default: | — |
Context: | server , location , if |
Stops processing and returns the specified code
to a client. The non-standard code 444 closes a connection without sending a response header.
Starting from version 0.8.42, it is possible to specify either a redirect URL (for codes 301, 302, 303, and 307), or the response body text
(for other codes). A response body text and redirect URL can contain variables. As a special case, a redirect URL can be specified as a URI local to this server, in which case the full redirect URL is formed according to the request scheme ($scheme
) and the server_name_in_redirect and port_in_redirect directives.
In addition, a URL
for temporary redirect with the code 302 can be specified as the sole parameter. Such a parameter should start with the “http://
”, “https://
”, or “$scheme
” string. A URL
can contain variables.
Only the following codes could be returned before version 0.7.51: 204, 400, 402 — 406, 408, 410, 411, 413, 416, and 500 — 504.
The code 307 was not treated as a redirect until versions 1.1.16 and 1.0.13.
See also the error_page directive.
Please login to continue.