Search code examples
httphttp2lighttpd

lighttpd not sending via HTTP/2


I'm on Raspbian Stable on Raspberry Pi 2, and I've compiled myself lighttpd version 1.4.59, that is supposed to have HTTP/2 enabled by default.

After installing it, everything seems ok:

pi@Raspi:~ $ lighttpd -V
lighttpd/1.4.59 - a light and fast webserver

Event Handlers:

        + select (generic)
        + poll (Unix)
        + epoll (Linux)
        - /dev/poll (Solaris)
        - eventports (Solaris)
        - kqueue (FreeBSD)
        - libev (generic)

Network handler:

        + linux-sendfile
        - freebsd-sendfile
        - darwin-sendfile
        - solaris-sendfilev
        + writev
        + write
        - mmap support

Features:

        + IPv6 support
        + zlib support
        - zstd support
        - bzip2 support
        - brotli support
        + crypt support
        - OpenSSL support
        - mbedTLS support
        - NSS crypto support
        - GnuTLS support
        - WolfSSL support
        - Nettle support
        + PCRE support
        - MySQL support
        - PgSQL support
        - DBI support
        - Kerberos support
        - LDAP support
        - PAM support
        - memcached support
        - FAM support
        - LUA support
        - xml support
        - SQLite support
        - GDBM support

But it seems that the pages are still transmitted via "http/1.1". I was expecting "h2" when getting a simple PHP page from the server:

HTTP/1.1 200 OK
Content-type: text/html; charset=UTF-8
Content-Length: 99966
Date: Tue, 09 Feb 2021 23:51:52 GMT
Server: lighttpd/1.4.59

enter image description here


Solution

  • @TheUnexpected: if your client makes an HTTP/1.1 request, then lighttpd will handle it as an HTTP/1.1 request. You can use mod_accesslog to log the request to an access log, or debug.log-request-header = "enable" to have lighttpd log to error log, if your client is making HTTP/1.1 requests, or if HTTP/2 has been negotiated.

    See man curl, specifically --http2 and --http2-prior-knowledge command line options, even when your target is http instead of https.