1 .\" Man page generated from reStructuredText.
3 .TH "NGHTTPX" "1" "Jun 02, 2020" "1.41.0" "nghttp2"
5 nghttpx \- HTTP/2 proxy
7 .nr rst2man-indent-level 0
11 level \\n[rst2man-indent-level]
12 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
19 .\" .rstReportMargin pre:
21 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22 . nr rst2man-indent-level +1
23 .\" .rstReportMargin post:
27 .\" indent \\n[an-margin]
28 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .nr rst2man-indent-level -1
30 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
35 \fBnghttpx\fP [OPTIONS]... [<PRIVATE_KEY> <CERT>]
38 A reverse proxy for HTTP/2, and HTTP/1.
42 Set path to server\(aqs private key. Required unless
43 "no\-tls" parameter is used in \fI\%\-\-frontend\fP option.
48 Set path to server\(aqs certificate. Required unless
49 "no\-tls" parameter is used in \fI\%\-\-frontend\fP option. To
50 make OCSP stapling work, this must be an absolute path.
54 The options are categorized into several groups.
58 .B \-b, \-\-backend=(<HOST>,<PORT>|unix:<PATH>)[;[<PATTERN>[:...]][[;<PARAM>]...]
59 Set backend host and port. The multiple backend
60 addresses are accepted by repeating this option. UNIX
61 domain socket can be specified by prefixing path name
62 with "unix:" (e.g., unix:/var/run/backend.sock).
64 Optionally, if <PATTERN>s are given, the backend address
65 is only used if request matches the pattern. The
66 pattern matching is closely designed to ServeMux in
67 net/http package of Go programming language. <PATTERN>
68 consists of path, host + path or just host. The path
69 must start with "\fI/\fP". If it ends with "\fI/\fP", it matches
70 all request path in its subtree. To deal with the
71 request to the directory without trailing slash, the
72 path which ends with "\fI/\fP" also matches the request path
73 which only lacks trailing \(aq\fI/\fP\(aq (e.g., path "\fI/foo/\fP"
74 matches request path "\fI/foo\fP"). If it does not end with
75 "\fI/\fP", it performs exact match against the request path.
76 If host is given, it performs a match against the
77 request host. For a request received on the frontend
78 listener with "sni\-fwd" parameter enabled, SNI host is
79 used instead of a request host. If host alone is given,
80 "\fI/\fP" is appended to it, so that it matches all request
81 paths under the host (e.g., specifying "nghttp2.org"
82 equals to "nghttp2.org/"). CONNECT method is treated
83 specially. It does not have path, and we don\(aqt allow
84 empty path. To workaround this, we assume that CONNECT
85 method has "\fI/\fP" as path.
87 Patterns with host take precedence over patterns with
88 just path. Then, longer patterns take precedence over
91 Host can include "*" in the left most position to
92 indicate wildcard match (only suffix match is done).
93 The "*" must match at least one character. For example,
94 host pattern "*.nghttp2.org" matches against
95 "www.nghttp2.org" and "git.ngttp2.org", but does not
96 match against "nghttp2.org". The exact hosts match
97 takes precedence over the wildcard hosts match.
99 If path part ends with "*", it is treated as wildcard
100 path. The wildcard path behaves differently from the
101 normal path. For normal path, match is made around the
102 boundary of path component separator,"\fI/\fP". On the other
103 hand, the wildcard path does not take into account the
104 path component separator. All paths which include the
105 wildcard path without last "*" as prefix, and are
106 strictly longer than wildcard path without last "*" are
107 matched. "*" must match at least one character. For
108 example, the pattern "\fI/foo*\fP" matches "\fI/foo/\fP" and
109 "\fI/foobar\fP". But it does not match "\fI/foo\fP", or "\fI/fo\fP".
111 If <PATTERN> is omitted or empty string, "\fI/\fP" is used as
112 pattern, which matches all request paths (catch\-all
113 pattern). The catch\-all backend must be given.
115 When doing a match, nghttpx made some normalization to
116 pattern, request host and path. For host part, they are
117 converted to lower case. For path part, percent\-encoded
118 unreserved characters defined in RFC 3986 are decoded,
119 and any dot\-segments (".." and ".") are resolved and
122 For example, \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org/httpbin/\(aq
123 matches the request host "nghttp2.org" and the request
124 path "\fI/httpbin/get\fP", but does not match the request host
125 "nghttp2.org" and the request path "\fI/index.html\fP".
127 The multiple <PATTERN>s can be specified, delimiting
128 them by ":". Specifying
129 \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org:www.nghttp2.org\(aq has the
130 same effect to specify \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org\(aq
131 and \fI\%\-b\fP\(aq127.0.0.1,8080;www.nghttp2.org\(aq.
133 The backend addresses sharing same <PATTERN> are grouped
134 together forming load balancing group.
136 Several parameters <PARAM> are accepted after <PATTERN>.
137 The parameters are delimited by ";". The available
138 parameters are: "proto=<PROTO>", "tls",
139 "sni=<SNI_HOST>", "fall=<N>", "rise=<N>",
140 "affinity=<METHOD>", "dns", "redirect\-if\-not\-tls",
141 "upgrade\-scheme", "mruby=<PATH>",
142 "read\-timeout=<DURATION>", "write\-timeout=<DURATION>",
143 "group=<GROUP>", "group\-weight=<N>", and "weight=<N>".
144 The parameter consists of keyword, and optionally
145 followed by "=" and value. For example, the parameter
146 "proto=h2" consists of the keyword "proto" and value
147 "h2". The parameter "tls" consists of the keyword "tls"
148 without value. Each parameter is described as follows.
150 The backend application protocol can be specified using
151 optional "proto" parameter, and in the form of
152 "proto=<PROTO>". <PROTO> should be one of the following
153 list without quotes: "h2", "http/1.1". The default
154 value of <PROTO> is "http/1.1". Note that usually "h2"
155 refers to HTTP/2 over TLS. But in this option, it may
156 mean HTTP/2 over cleartext TCP unless "tls" keyword is
159 TLS can be enabled by specifying optional "tls"
160 parameter. TLS is not enabled by default.
162 With "sni=<SNI_HOST>" parameter, it can override the TLS
163 SNI field value with given <SNI_HOST>. This will
164 default to the backend <HOST> name
166 The feature to detect whether backend is online or
167 offline can be enabled using optional "fall" and "rise"
168 parameters. Using "fall=<N>" parameter, if nghttpx
169 cannot connect to a this backend <N> times in a row,
170 this backend is assumed to be offline, and it is
171 excluded from load balancing. If <N> is 0, this backend
172 never be excluded from load balancing whatever times
173 nghttpx cannot connect to it, and this is the default.
174 There is also "rise=<N>" parameter. After backend was
175 excluded from load balancing group, nghttpx periodically
176 attempts to make a connection to the failed backend, and
177 if the connection is made successfully <N> times in a
178 row, the backend is assumed to be online, and it is now
179 eligible for load balancing target. If <N> is 0, a
180 backend is permanently offline, once it goes in that
181 state, and this is the default behaviour.
183 The session affinity is enabled using
184 "affinity=<METHOD>" parameter. If "ip" is given in
185 <METHOD>, client IP based session affinity is enabled.
186 If "cookie" is given in <METHOD>, cookie based session
187 affinity is enabled. If "none" is given in <METHOD>,
188 session affinity is disabled, and this is the default.
189 The session affinity is enabled per <PATTERN>. If at
190 least one backend has "affinity" parameter, and its
191 <METHOD> is not "none", session affinity is enabled for
192 all backend servers sharing the same <PATTERN>. It is
193 advised to set "affinity" parameter to all backend
194 explicitly if session affinity is desired. The session
195 affinity may break if one of the backend gets
196 unreachable, or backend settings are reloaded or
199 If "affinity=cookie" is used, the additional
200 configuration is required.
201 "affinity\-cookie\-name=<NAME>" must be used to specify a
202 name of cookie to use. Optionally,
203 "affinity\-cookie\-path=<PATH>" can be used to specify a
204 path which cookie is applied. The optional
205 "affinity\-cookie\-secure=<SECURE>" controls the Secure
206 attribute of a cookie. The default value is "auto", and
207 the Secure attribute is determined by a request scheme.
208 If a request scheme is "https", then Secure attribute is
209 set. Otherwise, it is not set. If <SECURE> is "yes",
210 the Secure attribute is always set. If <SECURE> is
211 "no", the Secure attribute is always omitted.
213 By default, name resolution of backend host name is done
214 at start up, or reloading configuration. If "dns"
215 parameter is given, name resolution takes place
216 dynamically. This is useful if backend address changes
217 frequently. If "dns" is given, name resolution of
218 backend host name at start up, or reloading
219 configuration is skipped.
221 If "redirect\-if\-not\-tls" parameter is used, the matched
222 backend requires that frontend connection is TLS
223 encrypted. If it isn\(aqt, nghttpx responds to the request
224 with 308 status code, and https URI the client should
225 use instead is included in Location header field. The
226 port number in redirect URI is 443 by default, and can
227 be changed using \fI\%\-\-redirect\-https\-port\fP option. If at
228 least one backend has "redirect\-if\-not\-tls" parameter,
229 this feature is enabled for all backend servers sharing
230 the same <PATTERN>. It is advised to set
231 "redirect\-if\-no\-tls" parameter to all backends
232 explicitly if this feature is desired.
234 If "upgrade\-scheme" parameter is used along with "tls"
235 parameter, HTTP/2 :scheme pseudo header field is changed
236 to "https" from "http" when forwarding a request to this
237 particular backend. This is a workaround for a backend
238 server which requires "https" :scheme pseudo header
239 field on TLS encrypted connection.
241 "mruby=<PATH>" parameter specifies a path to mruby
242 script file which is invoked when this pattern is
243 matched. All backends which share the same pattern must
244 have the same mruby path.
246 "read\-timeout=<DURATION>" and "write\-timeout=<DURATION>"
247 parameters specify the read and write timeout of the
248 backend connection when this pattern is matched. All
249 backends which share the same pattern must have the same
250 timeouts. If these timeouts are entirely omitted for a
251 pattern, \fI\%\-\-backend\-read\-timeout\fP and
252 \fI\%\-\-backend\-write\-timeout\fP are used.
254 "group=<GROUP>" parameter specifies the name of group
255 this backend address belongs to. By default, it belongs
256 to the unnamed default group. The name of group is
257 unique per pattern. "group\-weight=<N>" parameter
258 specifies the weight of the group. The higher weight
259 gets more frequently selected by the load balancing
260 algorithm. <N> must be [1, 256] inclusive. The weight
261 8 has 4 times more weight than 2. <N> must be the same
262 for all addresses which share the same <GROUP>. If
263 "group\-weight" is omitted in an address, but the other
264 address which belongs to the same group specifies
265 "group\-weight", its weight is used. If no
266 "group\-weight" is specified for all addresses, the
267 weight of a group becomes 1. "group" and "group\-weight"
268 are ignored if session affinity is enabled.
270 "weight=<N>" parameter specifies the weight of the
271 backend address inside a group which this address
272 belongs to. The higher weight gets more frequently
273 selected by the load balancing algorithm. <N> must be
274 [1, 256] inclusive. The weight 8 has 4 times more
275 weight than weight 2. If this parameter is omitted,
276 weight becomes 1. "weight" is ignored if session
279 Since ";" and ":" are used as delimiter, <PATTERN> must
280 not contain these characters. Since ";" has special
281 meaning in shell, the option value must be quoted.
283 Default: \fB127.0.0.1,80\fP
287 .B \-f, \-\-frontend=(<HOST>,<PORT>|unix:<PATH>)[[;<PARAM>]...]
288 Set frontend host and port. If <HOST> is \(aq*\(aq, it
289 assumes all addresses including both IPv4 and IPv6.
290 UNIX domain socket can be specified by prefixing path
291 name with "unix:" (e.g., unix:/var/run/nghttpx.sock).
292 This option can be used multiple times to listen to
295 This option can take 0 or more parameters, which are
296 described below. Note that "api" and "healthmon"
297 parameters are mutually exclusive.
299 Optionally, TLS can be disabled by specifying "no\-tls"
300 parameter. TLS is enabled by default.
302 If "sni\-fwd" parameter is used, when performing a match
303 to select a backend server, SNI host name received from
304 the client is used instead of the request host. See
305 \fI\%\-\-backend\fP option about the pattern match.
307 To make this frontend as API endpoint, specify "api"
308 parameter. This is disabled by default. It is
309 important to limit the access to the API frontend.
310 Otherwise, someone may change the backend server, and
311 break your services, or expose confidential information
312 to the outside the world.
314 To make this frontend as health monitor endpoint,
315 specify "healthmon" parameter. This is disabled by
316 default. Any requests which come through this address
317 are replied with 200 HTTP status, without no body.
319 To accept PROXY protocol version 1 and 2 on frontend
320 connection, specify "proxyproto" parameter. This is
323 Default: \fB*,3000\fP
328 Set listen backlog size.
334 .B \-\-backend\-address\-family=(auto|IPv4|IPv6)
335 Specify address family of backend connections. If
336 "auto" is given, both IPv4 and IPv6 are considered. If
337 "IPv4" is given, only IPv4 address is considered. If
338 "IPv6" is given, only IPv6 address is considered.
344 .B \-\-backend\-http\-proxy\-uri=<URI>
345 Specify proxy URI in the form
346 \fI\%http:/\fP/[<USER>:<PASS>@]<PROXY>:<PORT>. If a proxy
347 requires authentication, specify <USER> and <PASS>.
348 Note that they must be properly percent\-encoded. This
349 proxy is used when the backend connection is HTTP/2.
350 First, make a CONNECT request to the proxy and it
351 connects to the backend on behalf of nghttpx. This
352 forms tunnel. After that, nghttpx performs SSL/TLS
353 handshake with the downstream through the tunnel. The
354 timeouts when connecting and making CONNECT request can
355 be specified by \fI\%\-\-backend\-read\-timeout\fP and
356 \fI\%\-\-backend\-write\-timeout\fP options.
361 .B \-n, \-\-workers=<N>
362 Set the number of worker threads.
368 .B \-\-single\-thread
369 Run everything in one thread inside the worker process.
370 This feature is provided for better debugging
371 experience, or for the platforms which lack thread
372 support. If threading is disabled, this option is
377 .B \-\-read\-rate=<SIZE>
378 Set maximum average read rate on frontend connection.
379 Setting 0 to this option means read rate is unlimited.
385 .B \-\-read\-burst=<SIZE>
386 Set maximum read burst size on frontend connection.
387 Setting 0 to this option means read burst size is
394 .B \-\-write\-rate=<SIZE>
395 Set maximum average write rate on frontend connection.
396 Setting 0 to this option means write rate is unlimited.
402 .B \-\-write\-burst=<SIZE>
403 Set maximum write burst size on frontend connection.
404 Setting 0 to this option means write burst size is
411 .B \-\-worker\-read\-rate=<SIZE>
412 Set maximum average read rate on frontend connection per
413 worker. Setting 0 to this option means read rate is
414 unlimited. Not implemented yet.
420 .B \-\-worker\-read\-burst=<SIZE>
421 Set maximum read burst size on frontend connection per
422 worker. Setting 0 to this option means read burst size
423 is unlimited. Not implemented yet.
429 .B \-\-worker\-write\-rate=<SIZE>
430 Set maximum average write rate on frontend connection
431 per worker. Setting 0 to this option means write rate
432 is unlimited. Not implemented yet.
438 .B \-\-worker\-write\-burst=<SIZE>
439 Set maximum write burst size on frontend connection per
440 worker. Setting 0 to this option means write burst size
441 is unlimited. Not implemented yet.
447 .B \-\-worker\-frontend\-connections=<N>
448 Set maximum number of simultaneous connections frontend
449 accepts. Setting 0 means unlimited.
455 .B \-\-backend\-connections\-per\-host=<N>
456 Set maximum number of backend concurrent connections
457 (and/or streams in case of HTTP/2) per origin host.
458 This option is meaningful when \fI\%\-\-http2\-proxy\fP option is
459 used. The origin host is determined by authority
460 portion of request URI (or :authority header field for
461 HTTP/2). To limit the number of connections per
462 frontend for default mode, use
463 \fI\%\-\-backend\-connections\-per\-frontend\fP\&.
469 .B \-\-backend\-connections\-per\-frontend=<N>
470 Set maximum number of backend concurrent connections
471 (and/or streams in case of HTTP/2) per frontend. This
472 option is only used for default mode. 0 means
473 unlimited. To limit the number of connections per host
474 with \fI\%\-\-http2\-proxy\fP option, use
475 \fI\%\-\-backend\-connections\-per\-host\fP\&.
481 .B \-\-rlimit\-nofile=<N>
482 Set maximum number of open files (RLIMIT_NOFILE) to <N>.
483 If 0 is given, nghttpx does not set the limit.
489 .B \-\-backend\-request\-buffer=<SIZE>
490 Set buffer size used to store backend request.
496 .B \-\-backend\-response\-buffer=<SIZE>
497 Set buffer size used to store backend response.
504 Enables "TCP Fast Open" for the listening socket and
505 limits the maximum length for the queue of connections
506 that have not yet completed the three\-way handshake. If
507 value is 0 then fast open is disabled.
514 Don\(aqt use kqueue. This option is only applicable for
515 the platforms which have kqueue. For other platforms,
516 this option will be simply ignored.
521 .B \-\-frontend\-http2\-read\-timeout=<DURATION>
522 Specify read timeout for HTTP/2 frontend connection.
528 .B \-\-frontend\-read\-timeout=<DURATION>
529 Specify read timeout for HTTP/1.1 frontend connection.
535 .B \-\-frontend\-write\-timeout=<DURATION>
536 Specify write timeout for all frontend connections.
542 .B \-\-frontend\-keep\-alive\-timeout=<DURATION>
543 Specify keep\-alive timeout for frontend HTTP/1
550 .B \-\-stream\-read\-timeout=<DURATION>
551 Specify read timeout for HTTP/2 streams. 0 means no
558 .B \-\-stream\-write\-timeout=<DURATION>
559 Specify write timeout for HTTP/2 streams. 0 means no
566 .B \-\-backend\-read\-timeout=<DURATION>
567 Specify read timeout for backend connection.
573 .B \-\-backend\-write\-timeout=<DURATION>
574 Specify write timeout for backend connection.
580 .B \-\-backend\-connect\-timeout=<DURATION>
581 Specify timeout before establishing TCP connection to
588 .B \-\-backend\-keep\-alive\-timeout=<DURATION>
589 Specify keep\-alive timeout for backend HTTP/1
596 .B \-\-listener\-disable\-timeout=<DURATION>
597 After accepting connection failed, connection listener
598 is disabled for a given amount of time. Specifying 0
599 disables this feature.
605 .B \-\-frontend\-http2\-setting\-timeout=<DURATION>
606 Specify timeout before SETTINGS ACK is received from
613 .B \-\-backend\-http2\-settings\-timeout=<DURATION>
614 Specify timeout before SETTINGS ACK is received from
621 .B \-\-backend\-max\-backoff=<DURATION>
622 Specify maximum backoff interval. This is used when
623 doing health check against offline backend (see "fail"
624 parameter in \fI\%\-\-backend\fP option). It is also used to
625 limit the maximum interval to temporarily disable
626 backend when nghttpx failed to connect to it. These
627 intervals are calculated using exponential backoff, and
628 consecutive failed attempts increase the interval. This
629 option caps its maximum value.
636 .B \-\-ciphers=<SUITE>
637 Set allowed cipher list for frontend connection. The
638 format of the string is described in OpenSSL ciphers(1).
639 This option sets cipher suites for TLSv1.2 or earlier.
640 Use \fI\%\-\-tls13\-ciphers\fP for TLSv1.3.
642 Default: \fBECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256\fP
646 .B \-\-tls13\-ciphers=<SUITE>
647 Set allowed cipher list for frontend connection. The
648 format of the string is described in OpenSSL ciphers(1).
649 This option sets cipher suites for TLSv1.3. Use
650 \fI\%\-\-ciphers\fP for TLSv1.2 or earlier.
652 Default: \fBTLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\fP
656 .B \-\-client\-ciphers=<SUITE>
657 Set allowed cipher list for backend connection. The
658 format of the string is described in OpenSSL ciphers(1).
659 This option sets cipher suites for TLSv1.2 or earlier.
660 Use \fI\%\-\-tls13\-client\-ciphers\fP for TLSv1.3.
662 Default: \fBECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256\fP
666 .B \-\-tls13\-client\-ciphers=<SUITE>
667 Set allowed cipher list for backend connection. The
668 format of the string is described in OpenSSL ciphers(1).
669 This option sets cipher suites for TLSv1.3. Use
670 \fI\%\-\-tls13\-client\-ciphers\fP for TLSv1.2 or earlier.
672 Default: \fBTLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\fP
676 .B \-\-ecdh\-curves=<LIST>
677 Set supported curve list for frontend connections.
678 <LIST> is a colon separated list of curve NID or names
679 in the preference order. The supported curves depend on
680 the linked OpenSSL library. This function requires
683 Default: \fBX25519:P\-256:P\-384:P\-521\fP
688 Don\(aqt verify backend server\(aqs certificate if TLS is
689 enabled for backend connections.
694 Set path to trusted CA certificate file. It is used in
695 backend TLS connections to verify peer\(aqs certificate.
696 It is also used to verify OCSP response from the script
697 set by \fI\%\-\-fetch\-ocsp\-response\-file\fP\&. The file must be in
698 PEM format. It can contain multiple certificates. If
699 the linked OpenSSL is configured to load system wide
700 certificates, they are loaded at startup regardless of
705 .B \-\-private\-key\-passwd\-file=<PATH>
706 Path to file that contains password for the server\(aqs
707 private key. If none is given and the private key is
708 password protected it\(aqll be requested interactively.
712 .B \-\-subcert=<KEYPATH>:<CERTPATH>[[;<PARAM>]...]
713 Specify additional certificate and private key file.
714 nghttpx will choose certificates based on the hostname
715 indicated by client using TLS SNI extension. If nghttpx
716 is built with OpenSSL >= 1.0.2, the shared elliptic
717 curves (e.g., P\-256) between client and server are also
718 taken into consideration. This allows nghttpx to send
719 ECDSA certificate to modern clients, while sending RSA
720 based certificate to older clients. This option can be
721 used multiple times. To make OCSP stapling work,
722 <CERTPATH> must be absolute path.
724 Additional parameter can be specified in <PARAM>. The
725 available <PARAM> is "sct\-dir=<DIR>".
727 "sct\-dir=<DIR>" specifies the path to directory which
728 contains *.sct files for TLS
729 signed_certificate_timestamp extension (RFC 6962). This
730 feature requires OpenSSL >= 1.0.2. See also
731 \fI\%\-\-tls\-sct\-dir\fP option.
735 .B \-\-dh\-param\-file=<PATH>
736 Path to file that contains DH parameters in PEM format.
737 Without this option, DHE cipher suites are not
742 .B \-\-npn\-list=<LIST>
743 Comma delimited list of ALPN protocol identifier sorted
744 in the order of preference. That means most desirable
745 protocol comes first. This is used in both ALPN and
746 NPN. The parameter must be delimited by a single comma
747 only and any white spaces are treated as a part of
750 Default: \fBh2,h2\-16,h2\-14,http/1.1\fP
754 .B \-\-verify\-client
755 Require and verify client certificate.
759 .B \-\-verify\-client\-cacert=<PATH>
760 Path to file that contains CA certificates to verify
761 client certificate. The file must be in PEM format. It
762 can contain multiple certificates.
766 .B \-\-verify\-client\-tolerate\-expired
767 Accept expired client certificate. Operator should
768 handle the expired client certificate by some means
769 (e.g., mruby script). Otherwise, this option might
770 cause a security risk.
774 .B \-\-client\-private\-key\-file=<PATH>
775 Path to file that contains client private key used in
776 backend client authentication.
780 .B \-\-client\-cert\-file=<PATH>
781 Path to file that contains client certificate used in
782 backend client authentication.
786 .B \-\-tls\-min\-proto\-version=<VER>
787 Specify minimum SSL/TLS protocol. The name matching is
788 done in case\-insensitive manner. The versions between
789 \fI\%\-\-tls\-min\-proto\-version\fP and \fI\%\-\-tls\-max\-proto\-version\fP are
790 enabled. If the protocol list advertised by client does
791 not overlap this range, you will receive the error
792 message "unknown protocol". If a protocol version lower
793 than TLSv1.2 is specified, make sure that the compatible
794 ciphers are included in \fI\%\-\-ciphers\fP option. The default
795 cipher list only includes ciphers compatible with
796 TLSv1.2 or above. The available versions are:
797 TLSv1.3, TLSv1.2, TLSv1.1, and TLSv1.0
799 Default: \fBTLSv1.2\fP
803 .B \-\-tls\-max\-proto\-version=<VER>
804 Specify maximum SSL/TLS protocol. The name matching is
805 done in case\-insensitive manner. The versions between
806 \fI\%\-\-tls\-min\-proto\-version\fP and \fI\%\-\-tls\-max\-proto\-version\fP are
807 enabled. If the protocol list advertised by client does
808 not overlap this range, you will receive the error
809 message "unknown protocol". The available versions are:
810 TLSv1.3, TLSv1.2, TLSv1.1, and TLSv1.0
812 Default: \fBTLSv1.3\fP
816 .B \-\-tls\-ticket\-key\-file=<PATH>
817 Path to file that contains random data to construct TLS
818 session ticket parameters. If aes\-128\-cbc is given in
819 \fI\%\-\-tls\-ticket\-key\-cipher\fP, the file must contain exactly
820 48 bytes. If aes\-256\-cbc is given in
821 \fI\%\-\-tls\-ticket\-key\-cipher\fP, the file must contain exactly
822 80 bytes. This options can be used repeatedly to
823 specify multiple ticket parameters. If several files
824 are given, only the first key is used to encrypt TLS
825 session tickets. Other keys are accepted but server
826 will issue new session ticket with first key. This
827 allows session key rotation. Please note that key
828 rotation does not occur automatically. User should
829 rearrange files or change options values and restart
830 nghttpx gracefully. If opening or reading given file
831 fails, all loaded keys are discarded and it is treated
832 as if none of this option is given. If this option is
833 not given or an error occurred while opening or reading
834 a file, key is generated every 1 hour internally and
835 they are valid for 12 hours. This is recommended if
836 ticket key sharing between nghttpx instances is not
841 .B \-\-tls\-ticket\-key\-memcached=<HOST>,<PORT>[;tls]
842 Specify address of memcached server to get TLS ticket
843 keys for session resumption. This enables shared TLS
844 ticket key between multiple nghttpx instances. nghttpx
845 does not set TLS ticket key to memcached. The external
846 ticket key generator is required. nghttpx just gets TLS
847 ticket keys from memcached, and use them, possibly
848 replacing current set of keys. It is up to extern TLS
849 ticket key generator to rotate keys frequently. See
850 "TLS SESSION TICKET RESUMPTION" section in manual page
851 to know the data format in memcached entry. Optionally,
852 memcached connection can be encrypted with TLS by
853 specifying "tls" parameter.
857 .B \-\-tls\-ticket\-key\-memcached\-address\-family=(auto|IPv4|IPv6)
858 Specify address family of memcached connections to get
859 TLS ticket keys. If "auto" is given, both IPv4 and IPv6
860 are considered. If "IPv4" is given, only IPv4 address
861 is considered. If "IPv6" is given, only IPv6 address is
868 .B \-\-tls\-ticket\-key\-memcached\-interval=<DURATION>
869 Set interval to get TLS ticket keys from memcached.
875 .B \-\-tls\-ticket\-key\-memcached\-max\-retry=<N>
876 Set maximum number of consecutive retries before
877 abandoning TLS ticket key retrieval. If this number is
878 reached, the attempt is considered as failure, and
879 "failure" count is incremented by 1, which contributed
880 to the value controlled
881 \fI\%\-\-tls\-ticket\-key\-memcached\-max\-fail\fP option.
887 .B \-\-tls\-ticket\-key\-memcached\-max\-fail=<N>
888 Set maximum number of consecutive failure before
889 disabling TLS ticket until next scheduled key retrieval.
895 .B \-\-tls\-ticket\-key\-cipher=<CIPHER>
896 Specify cipher to encrypt TLS session ticket. Specify
897 either aes\-128\-cbc or aes\-256\-cbc. By default,
898 aes\-128\-cbc is used.
902 .B \-\-tls\-ticket\-key\-memcached\-cert\-file=<PATH>
903 Path to client certificate for memcached connections to
908 .B \-\-tls\-ticket\-key\-memcached\-private\-key\-file=<PATH>
909 Path to client private key for memcached connections to
914 .B \-\-fetch\-ocsp\-response\-file=<PATH>
915 Path to fetch\-ocsp\-response script file. It should be
918 Default: \fB/usr/local/share/nghttp2/fetch\-ocsp\-response\fP
922 .B \-\-ocsp\-update\-interval=<DURATION>
923 Set interval to update OCSP response cache.
930 Start accepting connections after initial attempts to
931 get OCSP responses finish. It does not matter some of
932 the attempts fail. This feature is useful if OCSP
933 responses must be available before accepting
938 .B \-\-no\-verify\-ocsp
939 nghttpx does not verify OCSP response.
944 Disable OCSP stapling.
948 .B \-\-tls\-session\-cache\-memcached=<HOST>,<PORT>[;tls]
949 Specify address of memcached server to store session
950 cache. This enables shared session cache between
951 multiple nghttpx instances. Optionally, memcached
952 connection can be encrypted with TLS by specifying "tls"
957 .B \-\-tls\-session\-cache\-memcached\-address\-family=(auto|IPv4|IPv6)
958 Specify address family of memcached connections to store
959 session cache. If "auto" is given, both IPv4 and IPv6
960 are considered. If "IPv4" is given, only IPv4 address
961 is considered. If "IPv6" is given, only IPv6 address is
968 .B \-\-tls\-session\-cache\-memcached\-cert\-file=<PATH>
969 Path to client certificate for memcached connections to
974 .B \-\-tls\-session\-cache\-memcached\-private\-key\-file=<PATH>
975 Path to client private key for memcached connections to
980 .B \-\-tls\-dyn\-rec\-warmup\-threshold=<SIZE>
981 Specify the threshold size for TLS dynamic record size
982 behaviour. During a TLS session, after the threshold
983 number of bytes have been written, the TLS record size
984 will be increased to the maximum allowed (16K). The max
985 record size will continue to be used on the active TLS
986 session. After \fI\%\-\-tls\-dyn\-rec\-idle\-timeout\fP has elapsed,
987 the record size is reduced to 1300 bytes. Specify 0 to
988 always use the maximum record size, regardless of idle
989 period. This behaviour applies to all TLS based
990 frontends, and TLS HTTP/2 backends.
996 .B \-\-tls\-dyn\-rec\-idle\-timeout=<DURATION>
997 Specify TLS dynamic record size behaviour timeout. See
998 \fI\%\-\-tls\-dyn\-rec\-warmup\-threshold\fP for more information.
999 This behaviour applies to all TLS based frontends, and
1000 TLS HTTP/2 backends.
1006 .B \-\-no\-http2\-cipher\-black\-list
1007 Allow black listed cipher suite on frontend HTTP/2
1009 \fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the
1010 complete HTTP/2 cipher suites black list.
1014 .B \-\-client\-no\-http2\-cipher\-black\-list
1015 Allow black listed cipher suite on backend HTTP/2
1017 \fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the
1018 complete HTTP/2 cipher suites black list.
1022 .B \-\-tls\-sct\-dir=<DIR>
1023 Specifies the directory where *.sct files exist. All
1024 *.sct files in <DIR> are read, and sent as
1025 extension_data of TLS signed_certificate_timestamp (RFC
1026 6962) to client. These *.sct files are for the
1027 certificate specified in positional command\-line
1028 argument <CERT>, or certificate option in configuration
1029 file. For additional certificates, use \fI\%\-\-subcert\fP
1030 option. This option requires OpenSSL >= 1.0.2.
1034 .B \-\-psk\-secrets=<PATH>
1035 Read list of PSK identity and secrets from <PATH>. This
1036 is used for frontend connection. The each line of input
1037 file is formatted as <identity>:<hex\-secret>, where
1038 <identity> is PSK identity, and <hex\-secret> is secret
1039 in hex. An empty line, and line which starts with \(aq#\(aq
1040 are skipped. The default enabled cipher list might not
1041 contain any PSK cipher suite. In that case, desired PSK
1042 cipher suites must be enabled using \fI\%\-\-ciphers\fP option.
1043 The desired PSK cipher suite may be black listed by
1044 HTTP/2. To use those cipher suites with HTTP/2,
1045 consider to use \fI\%\-\-no\-http2\-cipher\-black\-list\fP option.
1046 But be aware its implications.
1050 .B \-\-client\-psk\-secrets=<PATH>
1051 Read PSK identity and secrets from <PATH>. This is used
1052 for backend connection. The each line of input file is
1053 formatted as <identity>:<hex\-secret>, where <identity>
1054 is PSK identity, and <hex\-secret> is secret in hex. An
1055 empty line, and line which starts with \(aq#\(aq are skipped.
1056 The first identity and secret pair encountered is used.
1057 The default enabled cipher list might not contain any
1058 PSK cipher suite. In that case, desired PSK cipher
1059 suites must be enabled using \fI\%\-\-client\-ciphers\fP option.
1060 The desired PSK cipher suite may be black listed by
1061 HTTP/2. To use those cipher suites with HTTP/2,
1062 consider to use \fI\%\-\-client\-no\-http2\-cipher\-black\-list\fP
1063 option. But be aware its implications.
1067 .B \-\-tls\-no\-postpone\-early\-data
1068 By default, nghttpx postpones forwarding HTTP requests
1069 sent in early data, including those sent in partially in
1070 it, until TLS handshake finishes. If all backend server
1071 recognizes "Early\-Data" header field, using this option
1072 makes nghttpx not postpone forwarding request and get
1073 full potential of 0\-RTT data.
1077 .B \-\-tls\-max\-early\-data=<SIZE>
1078 Sets the maximum amount of 0\-RTT data that server
1086 .B \-c, \-\-frontend\-http2\-max\-concurrent\-streams=<N>
1087 Set the maximum number of the concurrent streams in one
1088 frontend HTTP/2 session.
1094 .B \-\-backend\-http2\-max\-concurrent\-streams=<N>
1095 Set the maximum number of the concurrent streams in one
1096 backend HTTP/2 session. This sets maximum number of
1097 concurrent opened pushed streams. The maximum number of
1098 concurrent requests are set by a remote server.
1104 .B \-\-frontend\-http2\-window\-size=<SIZE>
1105 Sets the per\-stream initial window size of HTTP/2
1106 frontend connection.
1108 Default: \fB65535\fP
1112 .B \-\-frontend\-http2\-connection\-window\-size=<SIZE>
1113 Sets the per\-connection window size of HTTP/2 frontend
1116 Default: \fB65535\fP
1120 .B \-\-backend\-http2\-window\-size=<SIZE>
1121 Sets the initial window size of HTTP/2 backend
1124 Default: \fB65535\fP
1128 .B \-\-backend\-http2\-connection\-window\-size=<SIZE>
1129 Sets the per\-connection window size of HTTP/2 backend
1132 Default: \fB2147483647\fP
1136 .B \-\-http2\-no\-cookie\-crumbling
1137 Don\(aqt crumble cookie header field.
1142 Add at most <N> bytes to a HTTP/2 frame payload as
1143 padding. Specify 0 to disable padding. This option is
1144 meant for debugging purpose and not intended to enhance
1149 .B \-\-no\-server\-push
1150 Disable HTTP/2 server push. Server push is supported by
1151 default mode and HTTP/2 frontend via Link header field.
1152 It is also supported if both frontend and backend are
1153 HTTP/2 in default mode. In this case, server push from
1154 backend session is relayed to frontend, and server push
1155 via Link header field is also supported.
1159 .B \-\-frontend\-http2\-optimize\-write\-buffer\-size
1160 (Experimental) Enable write buffer size optimization in
1161 frontend HTTP/2 TLS connection. This optimization aims
1162 to reduce write buffer size so that it only contains
1163 bytes which can send immediately. This makes server
1164 more responsive to prioritized HTTP/2 stream because the
1165 buffering of lower priority stream is reduced. This
1166 option is only effective on recent Linux platform.
1170 .B \-\-frontend\-http2\-optimize\-window\-size
1171 (Experimental) Automatically tune connection level
1172 window size of frontend HTTP/2 TLS connection. If this
1173 feature is enabled, connection window size starts with
1174 the default window size, 65535 bytes. nghttpx
1175 automatically adjusts connection window size based on
1176 TCP receiving window size. The maximum window size is
1177 capped by the value specified by
1178 \fI\%\-\-frontend\-http2\-connection\-window\-size\fP\&. Since the
1179 stream is subject to stream level window size, it should
1180 be adjusted using \fI\%\-\-frontend\-http2\-window\-size\fP option as
1181 well. This option is only effective on recent Linux
1186 .B \-\-frontend\-http2\-encoder\-dynamic\-table\-size=<SIZE>
1187 Specify the maximum dynamic table size of HPACK encoder
1188 in the frontend HTTP/2 connection. The decoder (client)
1189 specifies the maximum dynamic table size it accepts.
1190 Then the negotiated dynamic table size is the minimum of
1191 this option value and the value which client specified.
1197 .B \-\-frontend\-http2\-decoder\-dynamic\-table\-size=<SIZE>
1198 Specify the maximum dynamic table size of HPACK decoder
1199 in the frontend HTTP/2 connection.
1205 .B \-\-backend\-http2\-encoder\-dynamic\-table\-size=<SIZE>
1206 Specify the maximum dynamic table size of HPACK encoder
1207 in the backend HTTP/2 connection. The decoder (backend)
1208 specifies the maximum dynamic table size it accepts.
1209 Then the negotiated dynamic table size is the minimum of
1210 this option value and the value which backend specified.
1216 .B \-\-backend\-http2\-decoder\-dynamic\-table\-size=<SIZE>
1217 Specify the maximum dynamic table size of HPACK decoder
1218 in the backend HTTP/2 connection.
1226 Accept HTTP/2, and HTTP/1.1 over SSL/TLS. "no\-tls"
1227 parameter is used in \fI\%\-\-frontend\fP option, accept HTTP/2
1228 and HTTP/1.1 over cleartext TCP. The incoming HTTP/1.1
1229 connection can be upgraded to HTTP/2 through HTTP
1234 .B \-s, \-\-http2\-proxy
1235 Like default mode, but enable forward proxy. This is so
1236 called HTTP/2 proxy mode.
1241 .B \-L, \-\-log\-level=<LEVEL>
1242 Set the severity level of log output. <LEVEL> must be
1243 one of INFO, NOTICE, WARN, ERROR and FATAL.
1245 Default: \fBNOTICE\fP
1249 .B \-\-accesslog\-file=<PATH>
1250 Set path to write access log. To reopen file, send USR1
1255 .B \-\-accesslog\-syslog
1256 Send access log to syslog. If this option is used,
1257 \fI\%\-\-accesslog\-file\fP option is ignored.
1261 .B \-\-accesslog\-format=<FORMAT>
1262 Specify format string for access log. The default
1263 format is combined format. The following variables are
1267 $remote_addr: client IP address.
1269 $time_local: local time in Common Log format.
1271 $time_iso8601: local time in ISO 8601 format.
1273 $request: HTTP request line.
1275 $status: HTTP response status code.
1277 $body_bytes_sent: the number of bytes sent to client
1280 $http_<VAR>: value of HTTP request header <VAR> where
1281 \(aq_\(aq in <VAR> is replaced with \(aq\-\(aq.
1283 $remote_port: client port.
1285 $server_port: server port.
1287 $request_time: request processing time in seconds with
1288 milliseconds resolution.
1290 $pid: PID of the running process.
1292 $alpn: ALPN identifier of the protocol which generates
1293 the response. For HTTP/1, ALPN is always http/1.1,
1294 regardless of minor version.
1296 $tls_cipher: cipher used for SSL/TLS connection.
1298 $tls_client_fingerprint_sha256: SHA\-256 fingerprint of
1301 $tls_client_fingerprint_sha1: SHA\-1 fingerprint of
1304 $tls_client_subject_name: subject name in client
1307 $tls_client_issuer_name: issuer name in client
1310 $tls_client_serial: serial number in client
1313 $tls_protocol: protocol for SSL/TLS connection.
1315 $tls_session_id: session ID for SSL/TLS connection.
1317 $tls_session_reused: "r" if SSL/TLS session was
1318 reused. Otherwise, "."
1320 $tls_sni: SNI server name for SSL/TLS connection.
1322 $backend_host: backend host used to fulfill the
1323 request. "\-" if backend host is not available.
1325 $backend_port: backend port used to fulfill the
1326 request. "\-" if backend host is not available.
1329 The variable can be enclosed by "{" and "}" for
1330 disambiguation (e.g., ${remote_addr}).
1332 Default: \fB$remote_addr \- \- [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"\fP
1336 .B \-\-accesslog\-write\-early
1337 Write access log when response header fields are
1338 received from backend rather than when request
1339 transaction finishes.
1343 .B \-\-errorlog\-file=<PATH>
1344 Set path to write error log. To reopen file, send USR1
1345 signal to nghttpx. stderr will be redirected to the
1346 error log file unless \fI\%\-\-errorlog\-syslog\fP is used.
1348 Default: \fB/dev/stderr\fP
1352 .B \-\-errorlog\-syslog
1353 Send error log to syslog. If this option is used,
1354 \fI\%\-\-errorlog\-file\fP option is ignored.
1358 .B \-\-syslog\-facility=<FACILITY>
1359 Set syslog facility to <FACILITY>.
1361 Default: \fBdaemon\fP
1366 .B \-\-add\-x\-forwarded\-for
1367 Append X\-Forwarded\-For header field to the downstream
1372 .B \-\-strip\-incoming\-x\-forwarded\-for
1373 Strip X\-Forwarded\-For header field from inbound client
1378 .B \-\-no\-add\-x\-forwarded\-proto
1379 Don\(aqt append additional X\-Forwarded\-Proto header field
1380 to the backend request. If inbound client sets
1381 X\-Forwarded\-Proto, and
1382 \fI\%\-\-no\-strip\-incoming\-x\-forwarded\-proto\fP option is used,
1383 they are passed to the backend.
1387 .B \-\-no\-strip\-incoming\-x\-forwarded\-proto
1388 Don\(aqt strip X\-Forwarded\-Proto header field from inbound
1393 .B \-\-add\-forwarded=<LIST>
1394 Append RFC 7239 Forwarded header field with parameters
1395 specified in comma delimited list <LIST>. The supported
1396 parameters are "by", "for", "host", and "proto". By
1397 default, the value of "by" and "for" parameters are
1398 obfuscated string. See \fI\%\-\-forwarded\-by\fP and
1399 \fI\%\-\-forwarded\-for\fP options respectively. Note that nghttpx
1400 does not translate non\-standard X\-Forwarded\-* header
1401 fields into Forwarded header field, and vice versa.
1405 .B \-\-strip\-incoming\-forwarded
1406 Strip Forwarded header field from inbound client
1411 .B \-\-forwarded\-by=(obfuscated|ip|<VALUE>)
1412 Specify the parameter value sent out with "by" parameter
1413 of Forwarded header field. If "obfuscated" is given,
1414 the string is randomly generated at startup. If "ip" is
1415 given, the interface address of the connection,
1416 including port number, is sent with "by" parameter. In
1417 case of UNIX domain socket, "localhost" is used instead
1418 of address and port. User can also specify the static
1419 obfuscated string. The limitation is that it must start
1420 with "_", and only consists of character set
1421 [A\-Za\-z0\-9._\-], as described in RFC 7239.
1423 Default: \fBobfuscated\fP
1427 .B \-\-forwarded\-for=(obfuscated|ip)
1428 Specify the parameter value sent out with "for"
1429 parameter of Forwarded header field. If "obfuscated" is
1430 given, the string is randomly generated for each client
1431 connection. If "ip" is given, the remote client address
1432 of the connection, without port number, is sent with
1433 "for" parameter. In case of UNIX domain socket,
1434 "localhost" is used instead of address.
1436 Default: \fBobfuscated\fP
1441 Don\(aqt append to Via header field. If Via header field
1442 is received, it is left unaltered.
1446 .B \-\-no\-strip\-incoming\-early\-data
1447 Don\(aqt strip Early\-Data header field from inbound client
1452 .B \-\-no\-location\-rewrite
1453 Don\(aqt rewrite location header field in default mode.
1454 When \fI\%\-\-http2\-proxy\fP is used, location header field will
1455 not be altered regardless of this option.
1459 .B \-\-host\-rewrite
1460 Rewrite host and :authority header fields in default
1461 mode. When \fI\%\-\-http2\-proxy\fP is used, these headers will
1462 not be altered regardless of this option.
1466 .B \-\-altsvc=<PROTOID,PORT[,HOST,[ORIGIN]]>
1467 Specify protocol ID, port, host and origin of
1468 alternative service. <HOST> and <ORIGIN> are optional.
1469 They are advertised in alt\-svc header field only in
1470 HTTP/1.1 frontend. This option can be used multiple
1471 times to specify multiple alternative services.
1472 Example: \fI\%\-\-altsvc\fP=h2,443
1476 .B \-\-add\-request\-header=<HEADER>
1477 Specify additional header field to add to request header
1478 set. This option just appends header field and won\(aqt
1479 replace anything already set. This option can be used
1480 several times to specify multiple header fields.
1481 Example: \fI\%\-\-add\-request\-header\fP="foo: bar"
1485 .B \-\-add\-response\-header=<HEADER>
1486 Specify additional header field to add to response
1487 header set. This option just appends header field and
1488 won\(aqt replace anything already set. This option can be
1489 used several times to specify multiple header fields.
1490 Example: \fI\%\-\-add\-response\-header\fP="foo: bar"
1494 .B \-\-request\-header\-field\-buffer=<SIZE>
1495 Set maximum buffer size for incoming HTTP request header
1496 field list. This is the sum of header name and value in
1497 bytes. If trailer fields exist, they are counted
1498 towards this number.
1504 .B \-\-max\-request\-header\-fields=<N>
1505 Set maximum number of incoming HTTP request header
1506 fields. If trailer fields exist, they are counted
1507 towards this number.
1513 .B \-\-response\-header\-field\-buffer=<SIZE>
1514 Set maximum buffer size for incoming HTTP response
1515 header field list. This is the sum of header name and
1516 value in bytes. If trailer fields exist, they are
1517 counted towards this number.
1523 .B \-\-max\-response\-header\-fields=<N>
1524 Set maximum number of incoming HTTP response header
1525 fields. If trailer fields exist, they are counted
1526 towards this number.
1532 .B \-\-error\-page=(<CODE>|*)=<PATH>
1533 Set file path to custom error page served when nghttpx
1534 originally generates HTTP error status code <CODE>.
1535 <CODE> must be greater than or equal to 400, and at most
1536 599. If "*" is used instead of <CODE>, it matches all
1537 HTTP status code. If error status code comes from
1538 backend server, the custom error pages are not used.
1542 .B \-\-server\-name=<NAME>
1543 Change server response header field value to <NAME>.
1545 Default: \fBnghttpx\fP
1549 .B \-\-no\-server\-rewrite
1550 Don\(aqt rewrite server header field in default mode. When
1551 \fI\%\-\-http2\-proxy\fP is used, these headers will not be altered
1552 regardless of this option.
1556 .B \-\-redirect\-https\-port=<PORT>
1557 Specify the port number which appears in Location header
1558 field when redirect to HTTPS URI is made due to
1559 "redirect\-if\-not\-tls" parameter in \fI\%\-\-backend\fP option.
1566 .B \-\-api\-max\-request\-body=<SIZE>
1567 Set the maximum size of request body for API request.
1574 .B \-\-dns\-cache\-timeout=<DURATION>
1575 Set duration that cached DNS results remain valid. Note
1576 that nghttpx caches the unsuccessful results as well.
1582 .B \-\-dns\-lookup\-timeout=<DURATION>
1583 Set timeout that DNS server is given to respond to the
1584 initial DNS query. For the 2nd and later queries,
1585 server is given time based on this timeout, and it is
1592 .B \-\-dns\-max\-try=<N>
1593 Set the number of DNS query before nghttpx gives up name
1600 .B \-\-frontend\-max\-requests=<N>
1601 The number of requests that single frontend connection
1602 can process. For HTTP/2, this is the number of streams
1603 in one HTTP/2 connection. For HTTP/1, this is the
1604 number of keep alive requests. This is hint to nghttpx,
1605 and it may allow additional few requests. The default
1611 .B \-\-frontend\-http2\-dump\-request\-header=<PATH>
1612 Dumps request headers received by HTTP/2 frontend to the
1613 file denoted in <PATH>. The output is done in HTTP/1
1614 header field format and each header block is followed by
1615 an empty line. This option is not thread safe and MUST
1616 NOT be used with option \fI\%\-n\fP<N>, where <N> >= 2.
1620 .B \-\-frontend\-http2\-dump\-response\-header=<PATH>
1621 Dumps response headers sent from HTTP/2 frontend to the
1622 file denoted in <PATH>. The output is done in HTTP/1
1623 header field format and each header block is followed by
1624 an empty line. This option is not thread safe and MUST
1625 NOT be used with option \fI\%\-n\fP<N>, where <N> >= 2.
1629 .B \-o, \-\-frontend\-frame\-debug
1630 Print HTTP/2 frames in frontend to stderr. This option
1631 is not thread safe and MUST NOT be used with option
1632 \fI\%\-n\fP=N, where N >= 2.
1638 Run in a background. If \fI\%\-D\fP is used, the current working
1639 directory is changed to \(aq\fI/\fP\(aq.
1643 .B \-\-pid\-file=<PATH>
1644 Set path to save PID of this program.
1649 Run this program as <USER>. This option is intended to
1650 be used to drop root privileges.
1654 .B \-\-single\-process
1655 Run this program in a single process mode for debugging
1656 purpose. Without this option, nghttpx creates at least
1657 2 processes: master and worker processes. If this
1658 option is used, master and worker are unified into a
1659 single process. nghttpx still spawns additional process
1660 if neverbleed is used. In the single process mode, the
1661 signal handling feature is disabled.
1666 .B \-\-mruby\-file=<PATH>
1667 Set mruby script file
1671 .B \-\-ignore\-per\-pattern\-mruby\-error
1672 Ignore mruby compile error for per\-pattern mruby script
1673 file. If error occurred, it is treated as if no mruby
1674 file were specified for the pattern.
1680 Load configuration from <PATH>. Please note that
1681 nghttpx always tries to read the default configuration
1682 file if \fI\%\-\-conf\fP is not given.
1684 Default: \fB/etc/nghttpx/nghttpx.conf\fP
1688 .B \-\-include=<PATH>
1689 Load additional configurations from <PATH>. File <PATH>
1690 is read when configuration parser encountered this
1691 option. This option can be used multiple times, or even
1697 Print version and exit.
1702 Print this help and exit.
1705 The <SIZE> argument is an integer and an optional unit (e.g., 10K is
1706 10 * 1024). Units are K, M and G (powers of 1024).
1708 The <DURATION> argument is an integer and an optional unit (e.g., 1s
1709 is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
1710 (hours, minutes, seconds and milliseconds, respectively). If a unit
1711 is omitted, a second is used as unit.
1715 .B \fI/etc/nghttpx/nghttpx.conf\fP
1716 The default configuration file path nghttpx searches at startup.
1717 The configuration file path can be changed using \fI\%\-\-conf\fP
1720 Those lines which are staring \fB#\fP are treated as comment.
1722 The option name in the configuration file is the long command\-line
1723 option name with leading \fB\-\-\fP stripped (e.g., \fBfrontend\fP). Put
1724 \fB=\fP between option name and value. Don\(aqt put extra leading or
1727 When specifying arguments including characters which have special
1728 meaning to a shell, we usually use quotes so that shell does not
1729 interpret them. When writing this configuration file, quotes for
1730 this purpose must not be used. For example, specify additional
1731 request header field, do this:
1737 add\-request\-header=foo: bar
1749 add\-request\-header="foo: bar"
1755 The options which do not take argument in the command\-line \fItake\fP
1756 argument in the configuration file. Specify \fByes\fP as an argument
1757 (e.g., \fBhttp2\-proxy=yes\fP). If other string is given, it is
1760 To specify private key and certificate file which are given as
1761 positional arguments in command\-line, use \fBprivate\-key\-file\fP and
1762 \fBcertificate\-file\fP\&.
1764 \fI\%\-\-conf\fP option cannot be used in the configuration file and
1765 will be ignored if specified.
1768 Error log is written to stderr by default. It can be configured
1769 using \fI\%\-\-errorlog\-file\fP\&. The format of log message is as
1772 <datetime> <master\-pid> <current\-pid> <thread\-id> <level> (<filename>:<line>) <msg>
1776 It is a combination of date and time when the log is written. It
1777 is in ISO 8601 format.
1780 It is a master process ID.
1783 It is a process ID which writes this log.
1786 It is a thread ID which writes this log. It would be unique
1787 within <current\-pid>.
1789 .B <filename> and <line>
1790 They are source file name, and line number which produce this log.
1793 It is a log message body.
1800 Shutdown gracefully. First accept pending connections and stop
1801 accepting connection. After all connections are handled, nghttpx
1805 Reload configuration file given in \fI\%\-\-conf\fP\&.
1814 Fork and execute nghttpx. It will execute the binary in the same
1815 path with same command\-line arguments and environment variables. As
1816 of nghttpx version 1.20.0, the new master process sends SIGQUIT to
1817 the original master process when it is ready to serve requests. For
1818 the earlier versions of nghttpx, user has to send SIGQUIT to the
1819 original master process.
1821 The difference between SIGUSR2 (+ SIGQUIT) and SIGHUP is that former
1822 is usually used to execute new binary, and the master process is
1823 newly spawned. On the other hand, the latter just reloads
1824 configuration file, and the same master process continues to exist.
1831 nghttpx consists of multiple processes: one process for processing
1832 these signals, and another one for processing requests. The former
1833 spawns the latter. The former is called master process, and the
1834 latter is called worker process. If neverbleed is enabled, the
1835 worker process spawns neverbleed daemon process which does RSA key
1836 processing. The above signal must be sent to the master process.
1837 If the other processes received one of them, it is ignored. This
1838 behaviour of these processes may change in the future release. In
1839 other words, in the future release, the processes other than master
1840 process may terminate upon the reception of these signals.
1841 Therefore these signals should not be sent to the processes other
1842 than master process.
1847 nghttpx supports HTTP/2 server push in default mode with Link header
1848 field. nghttpx looks for Link header field (\fI\%RFC 5988\fP) in response headers from
1849 backend server and extracts URI\-reference with parameter
1850 \fBrel=preload\fP (see \fI\%preload\fP)
1851 and pushes those URIs to the frontend client. Here is a sample Link
1852 header field to initiate server push:
1858 Link: </fonts/font.woff>; rel=preload
1859 Link: </css/theme.css>; rel=preload
1865 Currently, the following restriction is applied for server push:
1868 The associated stream must have method "GET" or "POST". The
1869 associated stream\(aqs status code must be 200.
1872 This limitation may be loosened in the future release.
1874 nghttpx also supports server push if both frontend and backend are
1875 HTTP/2 in default mode. In this case, in addition to server push via
1876 Link header field, server push from backend is forwarded to frontend
1879 HTTP/2 server push will be disabled if \fI\%\-\-http2\-proxy\fP is
1881 .SH UNIX DOMAIN SOCKET
1883 nghttpx supports UNIX domain socket with a filename for both frontend
1884 and backend connections.
1886 Please note that current nghttpx implementation does not delete a
1887 socket with a filename. And on start up, if nghttpx detects that the
1888 specified socket already exists in the file system, nghttpx first
1889 deletes it. However, if SIGUSR2 is used to execute new binary and
1890 both old and new configurations use same filename, new binary does not
1891 delete the socket and continues to use it.
1894 OCSP query is done using external Python script
1895 \fBfetch\-ocsp\-response\fP, which has been originally developed in Perl
1896 as part of h2o project (\fI\%https://github.com/h2o/h2o\fP), and was
1897 translated into Python.
1899 The script file is usually installed under
1900 \fB$(prefix)/share/nghttp2/\fP directory. The actual path to script can
1901 be customized using \fI\%\-\-fetch\-ocsp\-response\-file\fP option.
1903 If OCSP query is failed, previous OCSP response, if any, is continued
1906 \fI\%\-\-fetch\-ocsp\-response\-file\fP option provides wide range of
1907 possibility to manage OCSP response. It can take an arbitrary script
1908 or executable. The requirement is that it supports the command\-line
1909 interface of \fBfetch\-ocsp\-response\fP script, and it must return a
1910 valid DER encoded OCSP response on success. It must return exit code
1911 0 on success, and 75 for temporary error, and the other error code for
1912 generic failure. For large cluster of servers, it is not efficient
1913 for each server to perform OCSP query using \fBfetch\-ocsp\-response\fP\&.
1914 Instead, you can retrieve OCSP response in some way, and store it in a
1915 disk or a shared database. Then specify a program in
1916 \fI\%\-\-fetch\-ocsp\-response\-file\fP to fetch it from those stores.
1917 This could provide a way to share the OCSP response between fleet of
1918 servers, and also any OCSP query strategy can be applied which may be
1919 beyond the ability of nghttpx itself or \fBfetch\-ocsp\-response\fP
1921 .SH TLS SESSION RESUMPTION
1923 nghttpx supports TLS session resumption through both session ID and
1925 .SS SESSION ID RESUMPTION
1927 By default, session ID is shared by all worker threads.
1929 If \fI\%\-\-tls\-session\-cache\-memcached\fP is given, nghttpx will
1930 insert serialized session data to memcached with
1931 \fBnghttpx:tls\-session\-cache:\fP + lowercase hex string of session ID
1932 as a memcached entry key, with expiry time 12 hours. Session timeout
1935 By default, connections to memcached server are not encrypted. To
1936 enable encryption, use \fBtls\fP keyword in
1937 \fI\%\-\-tls\-session\-cache\-memcached\fP option.
1938 .SS TLS SESSION TICKET RESUMPTION
1940 By default, session ticket is shared by all worker threads. The
1941 automatic key rotation is also enabled by default. Every an hour, new
1942 encryption key is generated, and previous encryption key becomes
1943 decryption only key. We set session timeout to 12 hours, and thus we
1944 keep at most 12 keys.
1946 If \fI\%\-\-tls\-ticket\-key\-memcached\fP is given, encryption keys are
1947 retrieved from memcached. nghttpx just reads keys from memcached; one
1948 has to deploy key generator program to update keys frequently (e.g.,
1949 every 1 hour). The example key generator tlsticketupdate.go is
1950 available under contrib directory in nghttp2 archive. The memcached
1951 entry key is \fBnghttpx:tls\-ticket\-key\fP\&. The data format stored in
1952 memcached is the binary format described below:
1958 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
1959 | VERSION (4) |LEN (2)|KEY(48 or 80) ...
1960 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
1963 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
1964 (LEN, KEY) pair can be repeated
1970 All numbers in the above figure is bytes. All integer fields are
1973 First 4 bytes integer VERSION field, which must be 1. The 2 bytes
1974 integer LEN field gives the length of following KEY field, which
1975 contains key. If \fI\%\-\-tls\-ticket\-key\-cipher\fP=aes\-128\-cbc is
1976 used, LEN must be 48. If
1977 \fI\%\-\-tls\-ticket\-key\-cipher\fP=aes\-256\-cbc is used, LEN must be
1978 80. LEN and KEY pair can be repeated multiple times to store multiple
1979 keys. The key appeared first is used as encryption key. All the
1980 remaining keys are used as decryption only.
1982 By default, connections to memcached server are not encrypted. To
1983 enable encryption, use \fBtls\fP keyword in
1984 \fI\%\-\-tls\-ticket\-key\-memcached\fP option.
1986 If \fI\%\-\-tls\-ticket\-key\-file\fP is given, encryption key is read
1987 from the given file. In this case, nghttpx does not rotate key
1988 automatically. To rotate key, one has to restart nghttpx (see
1990 .SH CERTIFICATE TRANSPARENCY
1992 nghttpx supports TLS \fBsigned_certificate_timestamp\fP extension (\fI\%RFC
1993 6962\fP). The relevant options
1994 are \fI\%\-\-tls\-sct\-dir\fP and \fBsct\-dir\fP parameter in
1995 \fI\%\-\-subcert\fP\&. They takes a directory, and nghttpx reads all
1996 files whose extension is \fB\&.sct\fP under the directory. The \fB*.sct\fP
1997 files are encoded as \fBSignedCertificateTimestamp\fP struct described
1998 in \fI\%section 3.2 of RFC 69662\fP\&. This format is
1999 the same one used by \fI\%nginx\-ct\fP and \fI\%mod_ssl_ct\fP\&.
2000 \fI\%ct\-submit\fP can be
2001 used to submit certificates to log servers, and obtain the
2002 \fBSignedCertificateTimestamp\fP struct which can be used with nghttpx.
2008 The current mruby extension API is experimental and not frozen. The
2009 API is subject to change in the future release.
2016 Almost all string value returned from method, or attribute is a
2017 fresh new mruby string, which involves memory allocation, and
2018 copies. Therefore, it is strongly recommended to store a return
2019 value in a local variable, and use it, instead of calling method or
2020 accessing attribute repeatedly.
2024 nghttpx allows users to extend its capability using mruby scripts.
2025 nghttpx has 2 hook points to execute mruby script: request phase and
2026 response phase. The request phase hook is invoked after all request
2027 header fields are received from client. The response phase hook is
2028 invoked after all response header fields are received from backend
2029 server. These hooks allows users to modify header fields, or common
2030 HTTP variables, like authority or request path, and even return custom
2031 response without forwarding request to backend servers.
2033 There are 2 levels of mruby script invocations: global and
2034 per\-pattern. The global mruby script is set by \fI\%\-\-mruby\-file\fP
2035 option and is called for all requests. The per\-pattern mruby script
2036 is set by "mruby" parameter in \fI\%\-b\fP option. It is invoked for
2037 a request which matches the particular pattern. The order of hook
2038 invocation is: global request phase hook, per\-pattern request phase
2039 hook, per\-pattern response phase hook, and finally global response
2040 phase hook. If a hook returns a response, any later hooks are not
2041 invoked. The global request hook is invoked before the pattern
2042 matching is made and changing request path may affect the pattern
2045 Please note that request and response hooks of per\-pattern mruby
2046 script for a single request might not come from the same script. This
2047 might happen after a request hook is executed, backend failed for some
2048 reason, and at the same time, backend configuration is replaced by API
2049 request, and then the request uses new configuration on retry. The
2050 response hook from new configuration, if it is specified, will be
2053 The all mruby script will be evaluated once per thread on startup, and
2054 it must instantiate object and evaluate it as the return value (e.g.,
2055 \fBApp.new\fP). This object is called app object. If app object
2056 defines \fBon_req\fP method, it is called with \fI\%Nghttpx::Env\fP
2057 object on request hook. Similarly, if app object defines \fBon_resp\fP
2058 method, it is called with \fI\%Nghttpx::Env\fP object on response
2059 hook. For each method invocation, user can can access
2060 \fI\%Nghttpx::Request\fP and \fI\%Nghttpx::Response\fP objects
2061 via \fI\%Nghttpx::Env#req\fP and \fI\%Nghttpx::Env#resp\fP
2065 .B Nghttpx::REQUEST_PHASE
2066 Constant to represent request phase.
2070 .B Nghttpx::RESPONSE_PHASE
2071 Constant to represent response phase.
2075 .B class Nghttpx::Env
2076 Object to represent current request specific context.
2079 .B attribute [R] req
2080 Return \fI\%Request\fP object.
2084 .B attribute [R] resp
2085 Return \fI\%Response\fP object.
2089 .B attribute [R] ctx
2090 Return Ruby hash object. It persists until request finishes.
2091 So values set in request phase hook can be retrieved in
2092 response phase hook.
2096 .B attribute [R] phase
2097 Return the current phase.
2101 .B attribute [R] remote_addr
2102 Return IP address of a remote client. If connection is made
2103 via UNIX domain socket, this returns the string "localhost".
2107 .B attribute [R] server_addr
2108 Return address of server that accepted the connection. This
2109 is a string which specified in \fI\%\-\-frontend\fP option,
2110 excluding port number, and not a resolved IP address. For
2111 UNIX domain socket, this is a path to UNIX domain socket.
2115 .B attribute [R] server_port
2116 Return port number of the server frontend which accepted the
2117 connection from client.
2121 .B attribute [R] tls_used
2122 Return true if TLS is used on the connection.
2126 .B attribute [R] tls_sni
2127 Return the TLS SNI value which client sent in this connection.
2131 .B attribute [R] tls_client_fingerprint_sha256
2132 Return the SHA\-256 fingerprint of a client certificate.
2136 .B attribute [R] tls_client_fingerprint_sha1
2137 Return the SHA\-1 fingerprint of a client certificate.
2141 .B attribute [R] tls_client_issuer_name
2142 Return the issuer name of a client certificate.
2146 .B attribute [R] tls_client_subject_name
2147 Return the subject name of a client certificate.
2151 .B attribute [R] tls_client_serial
2152 Return the serial number of a client certificate.
2156 .B attribute [R] tls_client_not_before
2157 Return the start date of a client certificate in seconds since
2162 .B attribute [R] tls_client_not_after
2163 Return the end date of a client certificate in seconds since
2168 .B attribute [R] tls_cipher
2169 Return a TLS cipher negotiated in this connection.
2173 .B attribute [R] tls_protocol
2174 Return a TLS protocol version negotiated in this connection.
2178 .B attribute [R] tls_session_id
2179 Return a session ID for this connection in hex string.
2183 .B attribute [R] tls_session_reused
2184 Return true if, and only if a SSL/TLS session is reused.
2188 .B attribute [R] alpn
2189 Return ALPN identifier negotiated in this connection.
2193 .B attribute [R] tls_handshake_finished
2194 Return true if SSL/TLS handshake has finished. If it returns
2195 false in the request phase hook, the request is received in
2196 TLSv1.3 early data (0\-RTT) and might be vulnerable to the
2197 replay attack. nghttpx will send Early\-Data header field to
2198 backend servers to indicate this.
2203 .B class Nghttpx::Request
2204 Object to represent request from client. The modification to
2205 Request object is allowed only in request phase hook.
2208 .B attribute [R] http_version_major
2209 Return HTTP major version.
2213 .B attribute [R] http_version_minor
2214 Return HTTP minor version.
2218 .B attribute [R/W] method
2219 HTTP method. On assignment, copy of given value is assigned.
2220 We don\(aqt accept arbitrary method name. We will document them
2221 later, but well known methods, like GET, PUT and POST, are all
2226 .B attribute [R/W] authority
2227 Authority (i.e., example.org), including optional port
2228 component . On assignment, copy of given value is assigned.
2232 .B attribute [R/W] scheme
2233 Scheme (i.e., http, https). On assignment, copy of given
2238 .B attribute [R/W] path
2239 Request path, including query component (i.e., /index.html).
2240 On assignment, copy of given value is assigned. The path does
2241 not include authority component of URI. This may include
2242 query component. nghttpx makes certain normalization for
2243 path. It decodes percent\-encoding for unreserved characters
2244 (see \fI\%https://tools.ietf.org/html/rfc3986#section\-2.3\fP), and
2245 resolves ".." and ".". But it may leave characters which
2246 should be percent\-encoded as is. So be careful when comparing
2247 path against desired string.
2251 .B attribute [R] headers
2252 Return Ruby hash containing copy of request header fields.
2253 Changing values in returned hash does not change request
2254 header fields actually used in request processing. Use
2255 \fI\%Nghttpx::Request#add_header\fP or
2256 \fI\%Nghttpx::Request#set_header\fP to change request
2261 .B add_header(key, value)
2262 Add header entry associated with key. The value can be single
2263 string or array of string. It does not replace any existing
2264 values associated with key.
2268 .B set_header(key, value)
2269 Set header entry associated with key. The value can be single
2270 string or array of string. It replaces any existing values
2271 associated with key.
2276 Clear all existing request header fields.
2281 Initiate to push resource identified by \fIuri\fP\&. Only HTTP/2
2282 protocol supports this feature. For the other protocols, this
2283 method is noop. \fIuri\fP can be absolute URI, absolute path or
2284 relative path to the current request. For absolute or
2285 relative path, scheme and authority are inherited from the
2286 current request. Currently, method is always GET. nghttpx
2287 will issue request to backend servers to fulfill this request.
2288 The request and response phase hooks will be called for pushed
2294 .B class Nghttpx::Response
2295 Object to represent response from backend server.
2298 .B attribute [R] http_version_major
2299 Return HTTP major version.
2303 .B attribute [R] http_version_minor
2304 Return HTTP minor version.
2308 .B attribute [R/W] status
2309 HTTP status code. It must be in the range [200, 999],
2310 inclusive. The non\-final status code is not supported in
2311 mruby scripting at the moment.
2315 .B attribute [R] headers
2316 Return Ruby hash containing copy of response header fields.
2317 Changing values in returned hash does not change response
2318 header fields actually used in response processing. Use
2319 \fI\%Nghttpx::Response#add_header\fP or
2320 \fI\%Nghttpx::Response#set_header\fP to change response
2325 .B add_header(key, value)
2326 Add header entry associated with key. The value can be single
2327 string or array of string. It does not replace any existing
2328 values associated with key.
2332 .B set_header(key, value)
2333 Set header entry associated with key. The value can be single
2334 string or array of string. It replaces any existing values
2335 associated with key.
2340 Clear all existing response header fields.
2345 Return custom response \fIbody\fP to a client. When this method
2346 is called in request phase hook, the request is not forwarded
2347 to the backend, and response phase hook for this request will
2348 not be invoked. When this method is called in response phase
2349 hook, response from backend server is canceled and discarded.
2350 The status code and response header fields should be set
2351 before using this method. To set status code, use
2352 \fI\%Nghttpx::Response#status\fP\&. If status code is not
2353 set, 200 is used. To set response header fields,
2354 \fI\%Nghttpx::Response#add_header\fP and
2355 \fI\%Nghttpx::Response#set_header\fP\&. When this method is
2356 invoked in response phase hook, the response headers are
2357 filled with the ones received from backend server. To send
2358 completely custom header fields, first call
2359 \fI\%Nghttpx::Response#clear_headers\fP to erase all
2360 existing header fields, and then add required header fields.
2361 It is an error to call this method twice for a given request.
2365 .B send_info(status, headers)
2366 Send non\-final (informational) response to a client. \fIstatus\fP
2367 must be in the range [100, 199], inclusive. \fIheaders\fP is a
2368 hash containing response header fields. Its key must be a
2369 string, and the associated value must be either string or
2370 array of strings. Since this is not a final response, even if
2371 this method is invoked, request is still forwarded to a
2372 backend unless \fI\%Nghttpx::Response#return\fP is called.
2373 This method can be called multiple times. It cannot be called
2374 after \fI\%Nghttpx::Response#return\fP is called.
2379 Modify request path:
2387 env.req.path = "/apps#{env.req.path}"
2397 Don\(aqt forget to instantiate and evaluate object at the last line.
2399 Restrict permission of viewing a content to a specific client
2408 allowed_clients = ["127.0.0.1", "::1"]
2410 if env.req.path.start_with?("/log/") &&
2411 !allowed_clients.include?(env.remote_addr) then
2412 env.resp.status = 404
2413 env.resp.return "permission denied"
2425 nghttpx exposes API endpoints to manipulate it via HTTP based API. By
2426 default, API endpoint is disabled. To enable it, add a dedicated
2427 frontend for API using \fI\%\-\-frontend\fP option with "api"
2428 parameter. All requests which come from this frontend address, will
2429 be treated as API request.
2431 The response is normally JSON dictionary, and at least includes the
2436 The status of the request processing. The following values are
2441 The request was successful.
2444 The request was failed. No change has been made.
2451 Additionally, depending on the API endpoint, \fBdata\fP key may be
2452 present, and its value contains the API endpoint specific data.
2454 We wrote "normally", since nghttpx may return ordinal HTML response in
2455 some cases where the error has occurred before reaching API endpoint
2456 (e.g., header field is too large).
2458 The following section describes available API endpoints.
2459 .SS POST /api/v1beta1/backendconfig
2461 This API replaces the current backend server settings with the
2462 requested ones. The request method should be POST, but PUT is also
2463 acceptable. The request body must be nghttpx configuration file
2464 format. For configuration file format, see \fI\%FILES\fP section. The
2465 line separator inside the request body must be single LF (0x0A).
2466 Currently, only \fI\%backend\fP option is parsed, the
2467 others are simply ignored. The semantics of this API is replace the
2468 current backend with the backend options in request body. Describe
2469 the desired set of backend severs, and nghttpx makes it happen. If
2470 there is no \fI\%backend\fP option is found in request
2471 body, the current set of backend is replaced with the \fI\%backend\fP option\(aqs default value, which is \fB127.0.0.1,80\fP\&.
2473 The replacement is done instantly without breaking existing
2474 connections or requests. It also avoids any process creation as is
2475 the case with hot swapping with signals.
2477 The one limitation is that only numeric IP address is allowed in
2478 \fI\%backend\fP in request body unless "dns" parameter
2479 is used while non numeric hostname is allowed in command\-line or
2480 configuration file is read using \fI\%\-\-conf\fP\&.
2481 .SS GET /api/v1beta1/configrevision
2483 This API returns configuration revision of the current nghttpx. The
2484 configuration revision is opaque string, and it changes after each
2485 reloading by SIGHUP. With this API, an external application knows
2486 that whether nghttpx has finished reloading its configuration by
2487 comparing the configuration revisions between before and after
2488 reloading. It is recommended to disable persistent (keep\-alive)
2489 connection for this purpose in order to avoid to send a request using
2490 the reused connection which may bound to an old process.
2492 This API returns response including \fBdata\fP key. Its value is JSON
2493 object, and it contains at least the following key:
2497 The configuration revision of the current nghttpx
2501 \fBnghttp(1)\fP, \fBnghttpd(1)\fP, \fBh2load(1)\fP
2505 2012, 2015, 2016, Tatsuhiro Tsujikawa
2506 .\" Generated by docutils manpage writer.