Mercurial > hg > nginx-quic
annotate README @ 7906:7995cd199b52 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 26 May 2020 20:26:44 +0300 |
parents | c7d1b500bd0a |
children | 4ea302a47d28 |
rev | line source |
---|---|
7843 | 1 Experimental QUIC support for nginx |
2 ----------------------------------- | |
3 | |
4 1. Introduction | |
5 2. Installing | |
6 3. Configuration | |
7 4. Clients | |
8 5. Troubleshooting | |
7887
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
9 6. Contributing |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
10 7. Links |
7843 | 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 | |
18 on nginx mainline 1.17.10. We are planning to merge new nginx | |
19 releases into this branch regularly. | |
20 | |
21 The project code base is under the same BSD license as nginx. | |
22 | |
23 The code is at an early alpha level of quality and should not | |
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 | |
37 Currently we support IETF-QUIC draft 27 | |
38 Earlier drafts are NOT supported as they have incompatible wire format; | |
39 | |
7887
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
40 Newer drafts development (draft-28 at the time of writing) is in progress. |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
41 You may look at src/event/ngx_event_quic.h for alternative values of the |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
42 NGX_QUIC_DRAFT_VERSION macro used to select IETF draft version number. |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
43 |
7843 | 44 nginx should be able to respond to simple HTTP/3 requests over QUIC and |
45 it should be possible to upload and download big files without errors. | |
46 | |
47 + The handshake completes successfully | |
48 + One endpoint can update keys and its peer responds correctly | |
7867 | 49 + 0-RTT data is being received and acted on |
7843 | 50 + Connection is established using TLS Resume Ticket |
7866
2b580ac17a47
README: Retry support, protocol error messages implemented.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7850
diff
changeset
|
51 + A handshake that includes a Retry packet completes successfully |
7843 | 52 + Stream data is being exchanged and ACK'ed |
53 + An H3 transaction succeeded | |
54 + One or both endpoints insert entries into dynamic table and | |
55 subsequently reference them from header blocks | |
56 | |
57 Not (yet) supported features: | |
58 | |
59 - Version negotiation | |
60 - ECN, Congestion control and friends as specified in quic-recovery [5] | |
61 - A connection with the spin bit succeeds and the bit is spinning | |
62 - Structured Logging | |
63 - QUIC recovery (proper congestion and flow control) | |
64 - NAT Rebinding | |
65 - Address Mobility | |
66 - Server push | |
67 - HTTP/3 trailers | |
68 | |
69 Since the code is experimental and still under development, | |
70 a lot of things may not work as expected, for example: | |
71 | |
72 - ACK handling is basic: every received ack-eliciting packet | |
73 is acknowledged, no ack ranges are used | |
74 | |
75 - Flow control mechanism is basic and intended to avoid CPU hog and make | |
76 simple interactions possible | |
77 | |
78 - Not all draft requirements are strictly followed; some of checks are | |
79 omitted for the sake of simplicity of initial implementation | |
80 | |
81 2. Installing | |
82 | |
83 You will need a BoringSSL [4] library that provides QUIC support | |
84 | |
7850
796b5b6c43cd
Mention quic branch in README.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7849
diff
changeset
|
85 $ hg clone -b quic https://hg.nginx.org/nginx-quic |
7843 | 86 $ cd nginx-quic |
7849
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7843
diff
changeset
|
87 $ ./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:
7843
diff
changeset
|
88 --with-cc-opt="-I../boringssl/include" \ |
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7843
diff
changeset
|
89 --with-ld-opt="-L../boringssl/build/ssl \ |
0e6528551f26
Configure: unbreak with old OpenSSL, --with-http_v3_module added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7843
diff
changeset
|
90 -L../boringssl/build/crypto" |
7843 | 91 $ make |
92 | |
93 3. Configuration | |
94 | |
95 The "listen" directive got a new option: "http3" | |
96 which enables HTTP/3 over QUIC on the specified port. | |
97 | |
98 Along with "http3", you also have to specify "reuseport" option [6] | |
99 to make it work properly with multiple workers. | |
100 | |
101 A number of directives were added that specify transport parameter values: | |
102 | |
103 quic_max_idle_timeout | |
104 quic_max_ack_delay | |
105 quic_max_packet_size | |
106 quic_initial_max_data | |
107 quic_initial_max_stream_data_bidi_local | |
108 quic_initial_max_stream_data_bidi_remote | |
109 quic_initial_max_stream_data_uni | |
110 quic_initial_max_streams_bidi | |
111 quic_initial_max_streams_uni | |
112 quic_ack_delay_exponent | |
113 quic_active_migration | |
114 quic_active_connection_id_limit | |
115 | |
7879
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
116 To enable address validation: |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
117 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
118 quic_retry on; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
119 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
120 To enable 0-RTT: |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
121 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
122 ssl_early_data on; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
123 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
124 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:
7873
diff
changeset
|
125 |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
126 ssl_protocols TLSv1.3; |
af22b60a905b
README: documented Retry, 0-RTT, TLSv1.3 configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7873
diff
changeset
|
127 |
7843 | 128 Two additional variables are available: $quic and $http3. |
129 The value of $quic is "quic" if QUIC connection is used, | |
130 and empty string otherwise. The value of $http3 is a string | |
131 "h3-xx" where "xx" is the supported draft number. | |
132 | |
133 Example configuration: | |
134 | |
135 http { | |
136 log_format quic '$remote_addr - $remote_user [$time_local] ' | |
137 '"$request" $status $body_bytes_sent ' | |
138 '"$http_referer" "$http_user_agent" "$quic" "$http3"'; | |
139 | |
140 access_log logs/access.log quic; | |
141 | |
142 server { | |
143 # for better compatibility it's recommended | |
144 # to use the same port for quic and https | |
145 listen 8443 http3 reuseport; | |
146 listen 8443 ssl; | |
147 | |
148 ssl_certificate certs/example.com.crt; | |
149 ssl_certificate_key certs/example.com.key; | |
150 ssl_protocols TLSv1.3; | |
151 | |
152 location / { | |
153 # required for browsers to direct them into quic port | |
7873
94c06fe6e159
README: pointed out Alt-Svc "ma" parameter useful with curl.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7872
diff
changeset
|
154 add_header Alt-Svc '$http3=":8443"; ma=86400'; |
7843 | 155 } |
156 } | |
157 } | |
158 | |
159 4. Clients | |
160 | |
161 * Browsers | |
162 | |
163 Known to work: Firefox 75+ and Chrome 83+ | |
164 | |
165 Beware of strange issues: sometimes browser may decide to ignore QUIC | |
166 Cache clearing/restart might help. Always check access.log and | |
167 error.log to make sure you are using HTTP/3 and not TCP https. | |
168 | |
169 + to enable QUIC in Firefox, set the following in 'about:config': | |
170 network.http.http3.enabled = true | |
171 | |
172 + to enable QUIC in Chrome, enable it on command line and force it | |
173 on your site: | |
174 | |
175 $ ./chrome --enable-quic --quic-version=h3-27 \ | |
176 --origin-to-force-quic-on=example.com:8443 | |
177 | |
178 * Console clients | |
179 | |
180 Known to work: ngtcp2, firefox's neqo and chromium's console clients: | |
181 | |
182 $ examples/client 127.0.0.1 8443 https://example.com:8443/index.html | |
183 | |
184 $ ./neqo-client https://127.0.0.1:8443/ | |
185 | |
186 $ chromium-build/out/my_build/quic_client http://example.com:8443 \ | |
187 --quic_version=h3-27 \ | |
188 --allow_unknown_root_cert \ | |
189 --disable_certificate_verification | |
190 | |
191 | |
192 If you've got it right, in the access log you should see something like: | |
193 | |
194 127.0.0.1 - - [24/Apr/2020:11:27:29 +0300] "GET / HTTP/3" 200 805 "-" | |
195 "nghttp3/ngtcp2 client" "quic" "h3-27" | |
196 | |
197 | |
198 5. Troubleshooting | |
199 | |
200 Here are some tips that may help you to identify problems: | |
201 | |
202 + Ensure you are building with proper SSL library that | |
203 implements draft 27 | |
204 | |
205 + Ensure you are using the proper SSL library in runtime | |
206 (`nginx -V` will show you what you are using) | |
207 | |
208 + Ensure your client is actually sending QUIC requests | |
209 (see "Clients" section about browsers and cache) | |
210 | |
211 We recommend to start with simple console client like ngtcp2 | |
212 to ensure you've got server configured properly before trying | |
7872 | 213 with real browsers that may be very picky with certificates, |
7843 | 214 for example. |
215 | |
216 + Build nginx with debug support [7] and check your debug log. | |
217 It should contain all details about connection and why it | |
218 failed. All related messages contain "quic " prefix and can | |
219 be easily filtered out. | |
220 | |
221 + If you want to investigate deeper, you may want to enable | |
222 additional debugging in src/event/ngx_event_quic.h: | |
223 | |
224 #define NGX_QUIC_DEBUG_PACKETS | |
225 #define NGX_QUIC_DEBUG_FRAMES | |
226 #define NGX_QUIC_DEBUG_FRAMES_ALLOC | |
227 #define NGX_QUIC_DEBUG_CRYPTO | |
228 | |
7887
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
229 6. Contributing |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
230 |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
231 If you are willing to contribute, please refer to |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
232 http://nginx.org/en/docs/contributing_changes.html |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
233 |
c7d1b500bd0a
Updated README with "Contributing" section and draft details.
Vladimir Homutov <vl@nginx.com>
parents:
7879
diff
changeset
|
234 7. Links |
7843 | 235 |
236 [1] https://tools.ietf.org/html/draft-ietf-quic-transport-27 | |
237 [2] https://tools.ietf.org/html/draft-ietf-quic-http-27 | |
238 [3] https://mailman.nginx.org/mailman/listinfo/nginx-devel | |
239 [4] https://boringssl.googlesource.com/boringssl/ | |
240 [5] https://tools.ietf.org/html/draft-ietf-quic-recovery-27 | |
241 [6] https://nginx.org/en/docs/http/ngx_http_core_module.html#listen | |
242 [7] https://nginx.org/en/docs/debugging_log.html |