tls property

TlsOptions? tls
final

Serve HTTPS on the port, with no proxy: the certificate chain and its private key, as PEM files. The port then speaks only TLS (1.2 and 1.3). A plain HTTP client gets no answer. With http2 on, the client picks HTTP/2 or HTTP/1.1 in the handshake (ALPN). req.scheme() is https, so cookies get Secure. A bad file throws a TlsException when the server starts. Dox().server.reloadCertificate() reads the files again, with no restart. For HTTPS on one port and plain HTTP on another, see ports. Native server only. Default null: plain HTTP.

tls: TlsOptions(
  certificatePath: '/etc/letsencrypt/live/example.com/fullchain.pem',
  keyPath: '/etc/letsencrypt/live/example.com/privkey.pem',
),

Implementation

final TlsOptions? tls;