Protocols and TLS

Choose a protocol

Set protocols.http to a string. The default is "1.1". Explicit selection makes missing dependencies a startup error. With "auto", the server tries HTTP/3, HTTP/2 and then HTTP/1.1 according to the available runtime and TLS configuration.

"1.1" · TCP
Works with plain HTTP or TLS. Plain application requests need only the base PHP extensions. HTTPS uses OpenSSL.
"2" · TLS over TCP
Requires a TLS mode, FFI enabled for the PHP CLI running the server, and libnghttp2 for header compression. Multiple requests can share a connection as separate streams.
"3" · QUIC over UDP
Requires TLS, FFI and a compatible native QUIC backend. The server tries quiche first, then the ngtcp2/nghttp3 adapter. For nonstandard installations, specify the shared library under protocols.http3.quiche.library or protocols.http3.ngtcp2.library. Both default to discovery.

Publish both UDP and TCP when deploying HTTP/3. The TCP companion lets clients reach the service and discover the QUIC endpoint. protocols.http3.public_port controls the port advertised in Alt-Svc. Its default, null, advertises listen.port. Set the external UDP port here when forwarding uses a different port.

Verify the connection

For local HTTP/2, run the bundled profile. It binds to 127.0.0.1:8443. In a second terminal, set CA to the public root certificate path printed in the tls.trust.root event.

Shell
php vendor/mini4work/webserver/examples/server.php vendor/mini4work/webserver/config/http2.json
Shell
curl --cacert "$CA" --http2 -sS -o /dev/null -w '%{http_version}\n' https://localhost:8443/

Expect 2. For HTTP/3, stop the first listener, start the bundled http3.json profile and repeat with --http3-only. Expect 3. Check curl -V for client protocol support if the option fails. A certificate verification failure concerns the client’s trust store or hostname.

Protocol timeouts

protocols.http1.header_timeout_seconds · 1
Time allowed to complete headers once the first request byte arrives.
protocols.http1.request_timeout_seconds · 5
Bounds the initial idle wait and the wait to admit and read a request body.
protocols.http1.connection_lifetime_seconds · 60
Stops new requests from starting on an aging connection. HTTP/1.1 timeouts also apply to the TCP TLS fallback listener.
protocols.http2.flow_control_timeout_seconds · 2
Limits the wait for a peer to grant DATA credit while sending an HTTP/2 response.