# HG changeset patch # User Yaroslav Zhuravlev # Date 1529412225 -10800 # Node ID 97526b8346f499d2328fd6d4a77f073500c5bd20 # Parent 7865ca0da0ab6c21ef0465bbf88089efab04cca3 Added r.internalRedirect and its example in njs. diff --git a/xml/en/docs/njs/njs_api.xml b/xml/en/docs/njs/njs_api.xml --- a/xml/en/docs/njs/njs_api.xml +++ b/xml/en/docs/njs/njs_api.xml @@ -269,6 +269,13 @@ writes a string to th on the info level of logging +r.internalRedirect(uri) + +performs an internal redirect to the specified uri. +If the uri starts with the “@” prefix, +it is considered a named location. + + r.method HTTP method, read-only @@ -526,6 +533,34 @@ function encoded_foo(r) { +
+ + + +js_include redirect.js; + +location /redirect { + js_content redirect; +} + +@named { + return 200 named; +} + + + + +The redirect.js file: + +function redirect(r) { + r.internalRedirect('@named'); +} + + + +
+ +