diff xml/en/docs/njs/njs_api.xml @ 2183:97526b8346f4

Added r.internalRedirect and its example in njs.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 19 Jun 2018 15:43:45 +0300
parents 7865ca0da0ab
children 8e2b3aadc3ce
line wrap: on
line diff
--- 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 <literal>info</literal> level of logging
 </tag-desc>
 
+<tag-name id="r_internal_redirect"><literal>r.internalRedirect(<value>uri</value>)</literal></tag-name>
+<tag-desc>
+performs an internal redirect to the specified <literal>uri</literal>.
+If the uri starts with the “<literal>@</literal>” prefix,
+it is considered a named location.
+</tag-desc>
+
 <tag-name><literal>r.method</literal></tag-name>
 <tag-desc>
 HTTP method, read-only
@@ -526,6 +533,34 @@
 </section>
 
 
+<section id="example_internal_redirect" name="Internal Redirect">
+
+<para>
+<example>
+js_include redirect.js;
+
+location /redirect {
+    js_content redirect;
+}
+
+@named {
+    return 200 named;
+}
+</example>
+</para>
+
+<para>
+The <path>redirect.js</path> file:
+<example>
+function redirect(r) {
+    r.internalRedirect('@named');
+}
+</example>
+</para>
+
+</section>
+
+
 <section id="example_fast_response" name="Returning Fastest Response from Proxy">
 
 <para>