Skip to content

HTTP2 without TLS #342

Open
Open
@WhyNotHugo

Description

The README explains how to set up HTTP2 with TLS, but there's no indication of how to set it up without TLS.

Just for context: my interest in doing this is because my load balancer already does the TLS termination. There's little sense in me setting up a pipeline to provision certificates to my django instances -- and the overhead of TLS between the load balancer and Django doesn't really make sense.

I've installed the optional dependencies:

pip install -U 'Twisted[tls,http2]'

And daphne indicates it supports HTTP2:

root@e4376f859b81:/app# bash scripts/run-django
[   DEBUG 2020-11-02 12:09:40] django.request:120  Asynchronous middleware django.middleware.clickjacking.XFrameOptionsMiddleware adapted.
[   DEBUG 2020-11-02 12:09:40] asyncio:59  Using selector: EpollSelector
[    INFO 2020-11-02 12:09:40] daphne.cli:287  Starting server at tcp:port=8000:interface=0.0.0.0
[    INFO 2020-11-02 12:09:40] daphne.server:108  HTTP/2 support enabled
[    INFO 2020-11-02 12:09:40] daphne.server:119  Configuring endpoint tcp:port=8000:interface=0.0.0.0
[    INFO 2020-11-02 12:09:40] daphne.server:150  Listening on TCP address 0.0.0.0:8000

However, it does not seem to actually operate on HTTP2, even using things like:

❯ curl -vI HEAD --http2 http://www.myapp.localhost:8000/
* Could not resolve host: HEAD
* Closing connection 0
curl: (6) Could not resolve host: HEAD
*   Trying ::1:8000...
* Connected to www.myapp.localhost (::1) port 8000 (#1)
> HEAD / HTTP/1.1
> Host: www.myapp.localhost:8000
> User-Agent: curl/7.73.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQCAAAAAAIAAAAA
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< X-Frame-Options: DENY
X-Frame-Options: DENY
< Vary: Cookie, Accept-Language
Vary: Cookie, Accept-Language
< Content-Length: 433909
Content-Length: 433909
< Content-Language: es
Content-Language: es

Am I testing this wrong, or would additional changes be required for daphne to support this?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions