Mercurial > hg > nginx-site
annotate xml/ru/docs/njs/examples.xml @ 2675:893cd7724c8c
Documented the "r" argument for js_body_filter.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 09 Mar 2021 18:44:56 +0000 |
parents | 4849fa0fd4b4 |
children | 9cafae0b7ef3 |
rev | line source |
---|---|
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <article name="Примеры использования" |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/njs/examples.html" |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
2643
4849fa0fd4b4
Removed URL Decoding/Encoding examples from njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2642
diff
changeset
|
12 rev="18"> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
13 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
14 <section id="summary"> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
15 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
16 <para> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
17 Примеры работают начиная с версии |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
18 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>. |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
19 </para> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
20 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
21 </section> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
2643
4849fa0fd4b4
Removed URL Decoding/Encoding examples from njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2642
diff
changeset
|
23 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
24 <section id="helloword" name="Hello World"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
25 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 events {} |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 http { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
32 js_import http.js; |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
33 |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
34 server { |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
35 listen 8000; |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
36 |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
37 location / { |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
38 js_content http.hello; |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
39 } |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
40 } |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
41 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
45 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
46 <literal>http.js</literal>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 function hello(r) { |
2257
8cef5ef98336
Changed quotes to ASCII in NJS example.
Nick Shadrin <nick@nginx.com>
parents:
2246
diff
changeset
|
49 r.return(200, "Hello world!"); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
50 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
51 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
52 export default {hello}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
54 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
57 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
58 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
59 <section id="http_auth" name="HTTP-авторизация"> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 <section id="jwt" name="Создание HS JWT"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
65 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
67 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
69 js_set $jwt http.jwt; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
74 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 <example> |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
76 function generate_hs256_jwt(claims, key, valid) { |
2527
351a669a576d
Corrected JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2520
diff
changeset
|
77 var header = { typ: "JWT", alg: "HS256" }; |
351a669a576d
Corrected JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2520
diff
changeset
|
78 var claims = Object.assign(claims, {exp: Math.floor(Date.now()/1000) + valid}); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
79 |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
80 var s = [header, claims].map(JSON.stringify) |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
81 .map(v=>v.toString('base64url')) |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
82 .join('.'); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 var h = require('crypto').createHmac('sha256', key); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 |
2639
7ad967af16b8
Updated HS JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2556
diff
changeset
|
86 return s + '.' + h.update(s).digest('base64url'); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
87 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 function jwt(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
90 var claims = { |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
91 iss: "nginx", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
92 sub: "alice", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
93 foo: 123, |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
94 bar: "qq", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
95 zyx: false |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 }; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
98 return generate_hs256_jwt(claims, 'foo', 600); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
99 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
100 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
101 export default {jwt}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
103 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
104 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
105 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
106 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
108 <section id="secure_link" name="Создание secure_link хэша"> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
109 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
110 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
111 <path>nginx.conf</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
112 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
113 js_import http.js; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
114 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
115 js_set $new_foo http.create_secure_link; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
116 ... |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
117 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
118 location / { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
119 secure_link $cookie_foo; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
120 secure_link_md5 "$uri mykey"; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
121 ... |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
122 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
123 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
124 location @login { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
125 add_header Set-Cookie "foo=$new_foo; Max-Age=60"; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
126 return 302 /; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
127 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
128 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
129 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
130 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
131 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
132 <path>http.js</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
133 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
134 function create_secure_link(r) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
135 return require('crypto').createHash('md5') |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
136 .update(r.uri).update(" mykey") |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
137 .digest('base64url'); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
138 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
139 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
140 export default {create_secure_link}; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
141 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
142 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
143 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
144 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
145 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
146 |
2640
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
147 <section id="jwt_field" name="Получение произвольного поля JWT |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
148 как значение переменной nginx"> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
149 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
150 <para> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
151 <path>nginx.conf</path>: |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
152 <example> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
153 js_import http.js; |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
154 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
155 js_set $jwt_payload_sub main.jwt_payload_sub; |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
156 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
157 server { |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
158 ... |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
159 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
160 location /jwt { |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
161 return 200 $jwt_payload_sub; |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
162 } |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
163 } |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
164 </example> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
165 </para> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
166 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
167 <para> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
168 <path>http.js</path>: |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
169 <example> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
170 function jwt(data) { |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
171 var parts = data.split('.').slice(0,2) |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
172 .map(v=>Buffer.from(v, 'base64url').toString()) |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
173 .map(JSON.parse); |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
174 return { headers:parts[0], payload: parts[1] }; |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
175 } |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
176 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
177 function jwt_payload_sub(r) { |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
178 return jwt(r.headersIn.Authorization.slice(7)).payload.sub; |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
179 } |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
180 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
181 export default {jwt_payload_sub} |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
182 </example> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
183 </para> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
184 |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
185 </section> |
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
186 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
187 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
188 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
189 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
190 <section id="http_proxying" name="HTTP-проксирование"> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
191 |
2640
885bcb41fbcf
Added an example to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2639
diff
changeset
|
192 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
193 <section id="subrequest" name="Доступ к API из подзапроса"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
195 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
198 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
199 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
200 keyval_zone zone=foo:10m; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
201 ... |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
202 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
203 location /keyval { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
204 js_content http.set_keyval; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
205 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
206 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
207 location /version { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
208 js_content http.version; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
209 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
210 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
211 location /api { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
212 api write=on; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
213 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
214 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
215 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
216 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
217 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
218 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
219 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
220 function set_keyval(r) { |
2438
86b0dd6e7208
Updated API version in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2433
diff
changeset
|
221 r.subrequest('/api/5/http/keyvals/foo', |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
222 { method: 'POST', |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
223 body: JSON.stringify({ foo: 789, bar: "ss dd 00" })}, |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
224 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
225 function(res) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
226 if (res.status >= 300) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
227 r.return(res.status, res.responseBody); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
228 return; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
229 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
230 r.return(500); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
231 }); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
232 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
233 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
234 function version(r) { |
2438
86b0dd6e7208
Updated API version in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2433
diff
changeset
|
235 r.subrequest('/api/5/nginx', { method: 'GET' }, function(res) { |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
236 if (res.status != 200) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
237 r.return(res.status); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
238 return; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
239 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
240 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
241 var json = JSON.parse(res.responseBody); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
242 r.return(200, json.version); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
243 }); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
244 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
245 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
246 export default {set_keyval, version}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
247 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
248 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
249 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
250 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
251 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
252 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
253 <section id="fast_response" name="Возвращение самого быстрого ответа от прокси"> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
254 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
255 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
256 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
257 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
258 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
259 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
260 location /start { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
261 js_content http.content; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
262 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
263 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
264 location /foo { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
265 proxy_pass http://backend1; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
266 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
267 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
268 location /bar { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
269 proxy_pass http://backend2; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
270 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
271 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
272 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
273 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
274 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
275 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
276 <example> |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
277 function content(r) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
278 var n = 0; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
279 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
280 function done(res) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
281 if (n++ == 0) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
282 r.return(res.status, res.responseBody); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
283 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
284 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
285 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
286 r.subrequest('/foo', r.variables.args, done); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
287 r.subrequest('/bar', r.variables.args, done); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
288 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
289 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
290 export default {content}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
291 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
292 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
293 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
294 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
295 |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
296 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
297 <section id="subrequests_chaining" name="Построение цепочки подзапросов"> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
298 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
299 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
300 <path>nginx.conf</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
301 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
302 js_import http.js; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
303 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
304 location /start { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
305 js_content http.content; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
306 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
307 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
308 location /auth { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
309 proxy_pass http://auth_backend; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
310 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
311 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
312 location /backend { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
313 proxy_pass http://backend; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
314 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
315 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
316 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
317 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
318 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
319 <path>http.js</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
320 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
321 function content(r) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
322 r.subrequest('/auth') |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
323 .then(reply => JSON.parse(reply.responseBody)) |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
324 .then(response => { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
325 if (!response['token']) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
326 throw new Error("token is not available"); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
327 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
328 return reply['token']; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
329 }) |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
330 .then(token => { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
331 r.subrequest('/backend', `token=${token}`) |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
332 .then(reply => r.return(reply.status, reply.responseBody)); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
333 }) |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
334 .catch(_ => r.return(500)); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
335 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
336 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
337 export default {content}; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
338 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
339 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
340 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
341 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
342 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
343 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
344 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
345 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
346 <section id="misc" name="Разное"> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
347 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
348 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
349 <section id="redirect" name="Внутренняя переадресация"> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
350 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
351 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
352 <path>nginx.conf</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
353 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
354 js_import http.js; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
355 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
356 location /redirect { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
357 js_content http.redirect; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
358 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
359 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
360 location @named { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
361 return 200 named; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
362 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
363 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
364 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
365 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
366 <para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
367 <path>http.js</path>: |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
368 <example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
369 function redirect(r) { |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
370 r.internalRedirect('@named'); |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
371 } |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
372 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
373 export default {redirect}; |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
374 </example> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
375 </para> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
376 |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
377 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
378 |
2643
4849fa0fd4b4
Removed URL Decoding/Encoding examples from njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2642
diff
changeset
|
379 |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
380 <section id="requests" name="Запись в лог количества запросов от клиента"> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
381 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
382 <para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
383 <path>nginx.conf</path>: |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
384 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
385 js_import http.js; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
386 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
387 js_set $num_requests http.num_requests; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
388 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
389 keyval_zone zone=foo:10m; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
390 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
391 keyval $remote_addr $foo zone=foo; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
392 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
393 log_format bar '$remote_addr [$time_local] $num_requests'; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
394 access_log logs/access.log bar; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
395 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
396 server { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
397 listen 8000; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
398 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
399 location / { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
400 root html; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
401 } |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
402 } |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
403 </example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
404 </para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
405 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
406 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
407 <path>http.js</path>: |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
408 <example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
409 function num_requests(r) |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
410 { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
411 var n = r.variables.foo; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
412 n = n ? Number(n) + 1 : 1; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
413 r.variables.foo = n; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
414 return n; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
415 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
416 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
417 export default {num_requests}; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
418 </example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
419 <note> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
420 Директивы <link doc="../http/ngx_http_keyval_module.xml" id="keyval"/> и |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
421 <link doc="../http/ngx_http_keyval_module.xml" id="keyval_zone"/> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
422 доступны как часть |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
423 <commercial_version>коммерческой подписки</commercial_version>. |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
424 </note> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
425 </para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
426 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
427 </section> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
428 |
2642
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
429 </section> |
c60bcc0de435
Updated TOC in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2640
diff
changeset
|
430 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
431 </article> |