S3 backend: HTTP2 support

Hello All,

I have been looking for ways to enable HTTP2 support when using restic 0.11.0 and restic 0.12.0 (mostly Windows) with the s3 backend. Particularly, the s3 backend is minio hosted on docker in the local network behind an nginx reverse proxy as per the official instructions at minio (both for nginx and minio). References: MinIO | Setup Nginx proxy with MinIO - Cookbook/Recipe .

In regards to what work and does not work:

  • I can see that minio client is able to use HTTP2 when talking to the same URL where the buckets are located
  • I can see that only restic is not doing HTTP2 via access logs on nginx
  • The previous link does not have configuration about HTTP2 and certificates, but I have added them to my instance of nginx and when I use google chrome it works as expected
  • I have read through the code and I believe that the only parameter to set for HTTP2 is done within the source code. There was a change just before 0.12.0, but it does not seem to apply to s3 backend. Ref: recent github commit HTTP2 HTTP backend
    • note that s3 then uses the default http.Transport which includes support for HTTP2 by default
  • I have not used HTTP2 in this environment before, but there is some evidence that it has worked:
  • the certificate is valid. the issuer is letsencrypt via local certbot
  • I have only read through the code, I have not done any debugging as I am not familiar enough with the core of restic that then calls this part of the code.

Thanks,
V

Hm, that’s indeed odd. Recently, we had a pull request which added HTTP2 back (it needs to be enabled explicitly when configuring an HTTP transport), that’d be #3254. This commit is included in 0.12.0 but not in 0.11.0.

Within the source, I just verified that the s3 backend configures the HTTP transport passed to it here:

It gets called here:

And the rt is instanciated here:

which calls Transport() from here:

And there you can see that ForceAttemptHTTP2 is indeed set to true. So it should work…

Can you please confirm that it does not work with restic 0.12.0? If that’s the case, please open an issue on GitHub, then you’ve found a bug :slight_smile:

2 Likes

fd0,

Thank you for this. I was about to dissect the code, but after sleeping on this issue for a couple of nights. I realized that I was using a different reverse proxy at the time I realized I had issues using HTTP2. I did entirely miss the first 3-4 times I reviewed this issue, because I was using s different host and server pair at the time.

I have now made sure that the temporary reverse proxy I was using is also set to to use ‘http2’ in the listen directive of nginx configuration.

Thanks,
V

1 Like

Thanks for the feedback and explaining the cause of your issue. Sometimes it’s easy in hindsight (and having a good night of sleep is a remarkable useful debug tool).