How do I completely disable http1 requests ? I want my webserver to only answer http2 requests

I am trying to create a webserver which only responds http2 requests.

By default http1 is answered. Is there anything I can do to disable responding http1 requests ?

Infact, while doing protocol negotiation (npn/alpn) I want to advertise only http2.

Use the alpn property of the tls directive: https://caddyserver.com/docs/tls

alpn http/1.1

That will disable h2.

@matt I want to disable http1 not http2
Can I do similar thing
alpn http/20 ?

Oh, right:

alpn h2

Will disable HTTP/1.

1 Like

Is there anything similar for connections using npn ?

No, NPN is old. EDIT: Actually the Go std lib might just use whatever the TLS version uses, so it might just work.

Okay Thanks for answering all the questions ! I appreciate the help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.