Mercurial > hg > nginx
annotate README @ 8761:225e9f1dfe7c quic
QUIC: renamed stream variables from sn to qs.
Currently both names are used which is confusing. Historically these were
different objects, but now it's the same one. The name qs (quic stream) makes
more sense than sn (stream node).
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 19 Apr 2021 17:25:56 +0300 |
parents | c8bda5e1e662 |
children | 4117aa7fa38e |
rev | line source |
---|---|
8366 | 1 Experimental QUIC support for nginx |
2 ----------------------------------- | |
3 | |
4 1. Introduction | |
5 2. Installing | |
6 3. Configuration | |
7 4. Clients | |
8 5. Troubleshooting | |
8410
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
9 6. Contributing |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
10 7. Links |
8366 | 11 |
12 1. Introduction | |
13 | |
14 This is an experimental QUIC [1] / HTTP/3 [2] support for nginx. | |
15 | |
16 The code is developed in a separate "quic" branch available | |
17 at https://hg.nginx.org/nginx-quic. Currently it is based | |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
18 on nginx mainline 1.19.x. We merge new nginx releases into |
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
19 this branch regularly. |
8366 | 20 |
21 The project code base is under the same BSD license as nginx. | |
22 | |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
23 The code is currently at a beta level of quality and should not |
8366 | 24 be used in production. |
25 | |
26 We are working on improving HTTP/3 support with the goal of | |
27 integrating it to the main NGINX codebase. Expect frequent | |
28 updates of this code and don't rely on it for whatever purpose. | |
29 | |
30 We'll be grateful for any feedback and code submissions however | |
31 we don't bear any responsibilities for any issues with this code. | |
32 | |
33 You can always contact us via nginx-devel mailing list [3]. | |
34 | |
35 What works now: | |
36 | |
8711
12df02cc709f
Updated the list of supported drafts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8684
diff
changeset
|
37 Currently we support IETF-QUIC draft-29 through draft-34. |
8449
3c32717d7bb2
README: documented draft-28, draft-29 support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8412
diff
changeset
|
38 Earlier drafts are NOT supported as they have incompatible wire format. |
8366 | 39 |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
40 nginx should be able to respond to HTTP/3 requests over QUIC and |
8366 | 41 it should be possible to upload and download big files without errors. |
42 | |
43 + The handshake completes successfully | |
44 + One endpoint can update keys and its peer responds correctly | |
8390 | 45 + 0-RTT data is being received and acted on |
8366 | 46 + Connection is established using TLS Resume Ticket |
8389
2b580ac17a47
README: Retry support, protocol error messages implemented.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8373
diff
changeset
|
47 + A handshake that includes a Retry packet completes successfully |
8366 | 48 + Stream data is being exchanged and ACK'ed |
49 + An H3 transaction succeeded | |
50 + One or both endpoints insert entries into dynamic table and | |
51 subsequently reference them from header blocks | |
8527 | 52 + Version Negotiation packet is sent to client with unknown version |
53 + Lost packets are detected and retransmitted properly | |
8366 | 54 |
55 Not (yet) supported features: | |
56 | |
8527 | 57 - Explicit Congestion Notification (ECN) as specified in quic-recovery [5] |
8366 | 58 - A connection with the spin bit succeeds and the bit is spinning |
59 - Structured Logging | |
60 - NAT Rebinding | |
61 - Address Mobility | |
62 - HTTP/3 trailers | |
63 | |
64 Since the code is experimental and still under development, | |
65 a lot of things may not work as expected, for example: | |
66 | |
67 - Flow control mechanism is basic and intended to avoid CPU hog and make | |
68 simple interactions possible | |
69 | |
70 - Not all draft requirements are strictly followed; some of checks are | |
71 omitted for the sake of simplicity of initial implementation | |
72 | |
73 2. Installing | |
74 | |
75 You will need a BoringSSL [4] library that provides QUIC support | |
76 | |
8373
796b5b6c43cd
Mention quic branch in README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8372
diff
changeset
|
77 $ hg clone -b quic https://hg.nginx.org/nginx-quic |
8366 | 78 $ cd nginx-quic |
8372
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8366
diff
changeset
|
79 $ ./auto/configure --with-debug --with-http_v3_module \ |
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8366
diff
changeset
|
80 --with-cc-opt="-I../boringssl/include" \ |
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8366
diff
changeset
|
81 --with-ld-opt="-L../boringssl/build/ssl \ |
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8366
diff
changeset
|
82 -L../boringssl/build/crypto" |
8366 | 83 $ make |
84 | |
8487
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
85 When configuring nginx, you can enable QUIC and HTTP/3 using the |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
86 following new configuration options: |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
87 |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
88 --with-http_v3_module - enable QUIC and HTTP/3 |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
89 --with-http_quic_module - enable QUIC for older HTTP versions |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
90 --with-stream_quic_module - enable QUIC in Stream |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
91 |
8366 | 92 3. Configuration |
93 | |
8487
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
94 The HTTP "listen" directive got two new options: "http3" and "quic". |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
95 The "http3" option enables HTTP/3 over QUIC on the specified port. |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
96 The "quic" option enables QUIC for older HTTP versions on this port. |
8366 | 97 |
8487
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
98 The Stream "listen" directive got a new option "quic" which enables |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
99 QUIC as client transport protocol instead of TCP or plain UDP. |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
100 |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
101 Along with "http3" or "quic", you also have to specify "reuseport" |
6e84524886d4
QUIC: updated README to mention "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
8449
diff
changeset
|
102 option [6] to make it work properly with multiple workers. |
8366 | 103 |
104 A number of directives were added that specify transport parameter values: | |
105 | |
106 quic_max_idle_timeout | |
107 quic_max_ack_delay | |
8684
27bd6dc24426
README: reflect renaming of several transport parameter directives.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8657
diff
changeset
|
108 quic_max_udp_payload_size |
8366 | 109 quic_initial_max_data |
110 quic_initial_max_stream_data_bidi_local | |
111 quic_initial_max_stream_data_bidi_remote | |
112 quic_initial_max_stream_data_uni | |
113 quic_initial_max_streams_bidi | |
114 quic_initial_max_streams_uni | |
115 quic_ack_delay_exponent | |
8684
27bd6dc24426
README: reflect renaming of several transport parameter directives.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8657
diff
changeset
|
116 quic_disable_active_migration |
8366 | 117 quic_active_connection_id_limit |
118 | |
8402
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
119 To enable address validation: |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
120 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
121 quic_retry on; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
122 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
123 To enable 0-RTT: |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
124 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
125 ssl_early_data on; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
126 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
127 Make sure that TLS 1.3 is configured which is required for QUIC: |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
128 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
129 ssl_protocols TLSv1.3; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8396
diff
changeset
|
130 |
8498
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
131 A number of directives were added that configure HTTP/3: |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
132 |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
133 http3_max_table_capacity |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
134 http3_max_blocked_streams |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
135 http3_max_concurrent_pushes |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
136 http3_push |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
137 http3_push_preload |
affb0245e291
QUIC: added HTTP/3 directives list to README.
Roman Arutyunyan <arut@nginx.com>
parents:
8487
diff
changeset
|
138 |
8366 | 139 Two additional variables are available: $quic and $http3. |
140 The value of $quic is "quic" if QUIC connection is used, | |
141 and empty string otherwise. The value of $http3 is a string | |
142 "h3-xx" where "xx" is the supported draft number. | |
143 | |
144 Example configuration: | |
145 | |
146 http { | |
147 log_format quic '$remote_addr - $remote_user [$time_local] ' | |
148 '"$request" $status $body_bytes_sent ' | |
149 '"$http_referer" "$http_user_agent" "$quic" "$http3"'; | |
150 | |
151 access_log logs/access.log quic; | |
152 | |
153 server { | |
154 # for better compatibility it's recommended | |
155 # to use the same port for quic and https | |
156 listen 8443 http3 reuseport; | |
157 listen 8443 ssl; | |
158 | |
159 ssl_certificate certs/example.com.crt; | |
160 ssl_certificate_key certs/example.com.key; | |
161 ssl_protocols TLSv1.3; | |
162 | |
163 location / { | |
164 # required for browsers to direct them into quic port | |
8396
94c06fe6e159
README: pointed out Alt-Svc "ma" parameter useful with curl.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8395
diff
changeset
|
165 add_header Alt-Svc '$http3=":8443"; ma=86400'; |
8366 | 166 } |
167 } | |
168 } | |
169 | |
170 4. Clients | |
171 | |
172 * Browsers | |
173 | |
8712
6da4b045ec34
README: bump browsers' version after 81bb3a690c10 (old drafts rip).
Sergey Kandaurov <pluknet@nginx.com>
parents:
8711
diff
changeset
|
174 Known to work: Firefox 80+ and Chrome 85+ (QUIC draft 29+) |
8366 | 175 |
176 Beware of strange issues: sometimes browser may decide to ignore QUIC | |
177 Cache clearing/restart might help. Always check access.log and | |
178 error.log to make sure you are using HTTP/3 and not TCP https. | |
179 | |
180 + to enable QUIC in Firefox, set the following in 'about:config': | |
181 network.http.http3.enabled = true | |
182 | |
183 + to enable QUIC in Chrome, enable it on command line and force it | |
184 on your site: | |
185 | |
8547
57e5393e5d40
QUIC: switched to draft 29 by default.
Vladimir Homutov <vl@nginx.com>
parents:
8527
diff
changeset
|
186 $ ./chrome --enable-quic --quic-version=h3-29 \ |
8366 | 187 --origin-to-force-quic-on=example.com:8443 |
188 | |
189 * Console clients | |
190 | |
191 Known to work: ngtcp2, firefox's neqo and chromium's console clients: | |
192 | |
193 $ examples/client 127.0.0.1 8443 https://example.com:8443/index.html | |
194 | |
195 $ ./neqo-client https://127.0.0.1:8443/ | |
196 | |
197 $ chromium-build/out/my_build/quic_client http://example.com:8443 \ | |
8547
57e5393e5d40
QUIC: switched to draft 29 by default.
Vladimir Homutov <vl@nginx.com>
parents:
8527
diff
changeset
|
198 --quic_version=h3-29 \ |
8366 | 199 --allow_unknown_root_cert \ |
200 --disable_certificate_verification | |
201 | |
202 | |
203 If you've got it right, in the access log you should see something like: | |
204 | |
205 127.0.0.1 - - [24/Apr/2020:11:27:29 +0300] "GET / HTTP/3" 200 805 "-" | |
8547
57e5393e5d40
QUIC: switched to draft 29 by default.
Vladimir Homutov <vl@nginx.com>
parents:
8527
diff
changeset
|
206 "nghttp3/ngtcp2 client" "quic" "h3-29" |
8366 | 207 |
208 | |
209 5. Troubleshooting | |
210 | |
211 Here are some tips that may help you to identify problems: | |
212 | |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
213 + Ensure you are building with proper SSL library that supports QUIC |
8366 | 214 |
215 + Ensure you are using the proper SSL library in runtime | |
216 (`nginx -V` will show you what you are using) | |
217 | |
218 + Ensure your client is actually sending QUIC requests | |
219 (see "Clients" section about browsers and cache) | |
220 | |
221 We recommend to start with simple console client like ngtcp2 | |
222 to ensure you've got server configured properly before trying | |
8395 | 223 with real browsers that may be very picky with certificates, |
8366 | 224 for example. |
225 | |
226 + Build nginx with debug support [7] and check your debug log. | |
227 It should contain all details about connection and why it | |
228 failed. All related messages contain "quic " prefix and can | |
229 be easily filtered out. | |
230 | |
231 + If you want to investigate deeper, you may want to enable | |
8747 | 232 additional debugging in src/event/ngx_event_quic_connection.h: |
8366 | 233 |
234 #define NGX_QUIC_DEBUG_PACKETS | |
235 #define NGX_QUIC_DEBUG_FRAMES | |
8657
2dfc5ef29973
QUIC: introduced QUIC buffers.
Roman Arutyunyan <arut@nginx.com>
parents:
8601
diff
changeset
|
236 #define NGX_QUIC_DEBUG_ALLOC |
8366 | 237 #define NGX_QUIC_DEBUG_CRYPTO |
238 | |
8410
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
239 6. Contributing |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
240 |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
241 If you are willing to contribute, please refer to |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
242 http://nginx.org/en/docs/contributing_changes.html |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
243 |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
8402
diff
changeset
|
244 7. Links |
8366 | 245 |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
246 [1] https://tools.ietf.org/html/draft-ietf-quic-transport |
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
247 [2] https://tools.ietf.org/html/draft-ietf-quic-http |
8366 | 248 [3] https://mailman.nginx.org/mailman/listinfo/nginx-devel |
249 [4] https://boringssl.googlesource.com/boringssl/ | |
8601
dd8e50e11bfc
QUIC: updated README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8547
diff
changeset
|
250 [5] https://tools.ietf.org/html/draft-ietf-quic-recovery |
8366 | 251 [6] https://nginx.org/en/docs/http/ngx_http_core_module.html#listen |
252 [7] https://nginx.org/en/docs/debugging_log.html |