# HG changeset patch # User Yaroslav Zhuravlev # Date 1529412225 -10800 # Node ID 97526b8346f499d2328fd6d4a77f073500c5bd20 # Parent 7865ca0da0ab6c21ef0465bbf88089efab04cca3 Added r.internalRedirect and its example in njs. diff -r 7865ca0da0ab -r 97526b8346f4 xml/en/docs/njs/njs_api.xml --- a/xml/en/docs/njs/njs_api.xml Tue Jun 19 15:43:42 2018 +0300 +++ b/xml/en/docs/njs/njs_api.xml Tue Jun 19 15:43:45 2018 +0300 @@ -269,6 +269,13 @@ 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 @@ +
+ + + +js_include redirect.js; + +location /redirect { + js_content redirect; +} + +@named { + return 200 named; +} + + + + +The redirect.js file: + +function redirect(r) { + r.internalRedirect('@named'); +} + + + +
+ +