comparison xml/en/docs/njs/reference.xml @ 2894:438a9cfa4fae

Added info about setting r.headersOut in njs reference.
author Yaroslav Zhuravlev <yar@nginx.com>
date Fri, 30 Sep 2022 16:42:42 +0100
parents 88956e57f930
children 843bf979dcaa
comparison
equal deleted inserted replaced
2893:8f3955097546 2894:438a9cfa4fae
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
8 8
9 <article name="Reference" 9 <article name="Reference"
10 link="/en/docs/njs/reference.html" 10 link="/en/docs/njs/reference.html"
11 lang="en" 11 lang="en"
12 rev="89"> 12 rev="90">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 <link doc="index.xml">njs</link> provides objects, methods and properties 17 <link doc="index.xml">njs</link> provides objects, methods and properties
168 outgoing headers object, writable. 168 outgoing headers object, writable.
169 <para> 169 <para>
170 The <header>Foo</header> response header 170 The <header>Foo</header> response header
171 can be accessed with the syntax: 171 can be accessed with the syntax:
172 <literal>headersOut.foo</literal> or <literal>headersOut['Foo']</literal>. 172 <literal>headersOut.foo</literal> or <literal>headersOut['Foo']</literal>.
173 </para>
174
175 <para>
176 Outgoing headers should be set before a response header is sent to a client,
177 otherwise header update will be ignored.
178 This means that <literal>r.headersOut{}</literal> is effectively writable in:
179
180 <list type="bullet">
181
182 <listitem>
183 the <link doc="../http/ngx_http_js_module.xml" id="js_content"/> handler before
184 <link id="r_send_header"><literal>r.sendHeader()</literal></link> or
185 <link id="r_return"><literal>r.return()</literal></link> are called
186 </listitem>
187
188 <listitem>
189 the <link doc="../http/ngx_http_js_module.xml" id="js_header_filter"/> handler
190 </listitem>
191
192 </list>
173 </para> 193 </para>
174 194
175 <para> 195 <para>
176 Field values of multi-value response headers 196 Field values of multi-value response headers
177 (<link doc="changes.xml" id="njs0.4.0">0.4.0</link>) 197 (<link doc="changes.xml" id="njs0.4.0">0.4.0</link>)