Using HTTP/2 and SSL with Meilisearch
Learn how to configure a server to use Meilisearch with HTTP/2.
For those willing to use HTTP/2, please be aware that it is only possible if your server is configured with SSL certificate.
Therefore, you will see how to launch a Meilisearch server with SSL. This tutorial gives a short introduction to do it locally, but you can as well do the same thing on a remote server.
First of all, you need the binary of Meilisearch, or you can also use docker. In the latter case, it is necessary to pass the parameters using environment variables and the SSL certificates via a volume.
A tool to generate SSL certificates is also required. In this How To, you will use mkcert. However, if on a remote server, you can also use certbot or certificates signed by a Certificate Authority.
Then, use curl
to do requests. It is a simple way to specify that you want to send HTTP/2 requests by using the --http2
option.
Try to use HTTP/2 without SSL
Start by running the binary.
And then, send a request.
You will get the following answer from the server:
You can see on line > Connection: Upgrade, HTTP2-Settings
that the server tries to upgrade to HTTP/2, but is unsuccessful.
The answer < HTTP/1.1 200 OK
indicates that the server still uses HTTP/1.
Try to use HTTP/2 with SSL
This time, start by generating the SSL certificates. mkcert creates two files: 127.0.0.1.pem
and 127.0.0.1-key.pem
.
Then, use the certificate and the key to configure Meilisearch with SSL.
Next, make the same request as above but change http://
to https://
.
You will get the following answer from the server:
You can see that the server now supports HTTP/2.
The server successfully receives HTTP/2 requests.
Was this page helpful?