# Is http2 supported?

**URL:** <https://swi-prolog.discourse.group/t/is-http2-supported/6724>\
**Category:** General\
**Tags:** http, how-to\
**Created:** [July 20, 2023, 11:48pm UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724 "2023-07-20T23:48:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![heiheshang](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/heiheshang/32/4419_2.png) [@heiheshang](https://swi-prolog.discourse.group/u/heiheshang)\
**Post date:** [July 20, 2023, 11:48pm UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724/1 "2023-07-20T23:48:12Z")

</div>

ran into a problem, the server always responds with HTTP 1.1, how to make it work with http 2 ?

---

<div class="post-metadata">

**Author:** ![jamesnvc](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jamesnvc/32/14_2.png) [@jamesnvc](https://swi-prolog.discourse.group/u/jamesnvc)\
**Post date:** [July 21, 2023, 12:01am UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724/2 "2023-07-21T00:01:09Z")

</div>

HTTP 2 is a very different protocol that would require serious work to implement. For a client, I wrote [one a while ago](https://github.com/jamesnvc/http2_client), but I’m not aware of a Prolog server implementation for the same.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 21, 2023, 7:15am UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724/3 "2023-07-21T07:15:01Z")

</div>

I guess it should be possible to add http2 to the server, but indeed it will be a bit of work. For now, if you really need it, the best is probably to use a proxy such as nginx.

---

<div class="post-metadata">

**Author:** ![heiheshang](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/heiheshang/32/4419_2.png) [@heiheshang](https://swi-prolog.discourse.group/u/heiheshang)\
**Post date:** [July 21, 2023, 1:13pm UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724/4 "2023-07-21T13:13:42Z")

</div>

I’m not sure what’s wrong with http2. I set up a backend for [netlify.com](http://netlify.com) and see that they accept as http 2. I also see that the https server is giving an invalid certificate. I made a request to the openssl s\_client server and I see the difference when the certificate gives cowboy and swi https  
swi https

```prolog
CONNECTED(00000003)
depth=0 CN = v.hopto.org
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = v.hopto.org
verify error:num=21:unable to verify the first certificate
verify return:1
depth=0 CN = v.hopto.org
verify return:1

```

cowboy

```prolog
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = v.hopto.org
verify return:1

```

I use the same certificate and key for both servers. Everything is running on the same host. Through curl, requests to the backend go through without problems, with a redirect through netlify there are problems.

---

<div class="post-metadata">

**Author:** ![heiheshang](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/heiheshang/32/4419_2.png) [@heiheshang](https://swi-prolog.discourse.group/u/heiheshang)\
**Post date:** [August 9, 2023, 11:25am UTC](https://swi-prolog.discourse.group/t/is-http2-supported/6724/5 "2023-08-09T11:25:36Z")

</div>

it looks like there is some problem with the certificates, I installed the certificate files along with the root certificate, but the server does not give the root certificate as I understand it.
