Upload to backblaze B2 is failing. It used to work.
Error is:
Backblaze B2 API Error bad_request: Missing header: X-Bz-Content-Sha1
Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Latest post by nicholas on Monday, 16 May 2022 02:02 CDT
Upload to backblaze B2 is failing. It used to work.
Error is:
Backblaze B2 API Error bad_request: Missing header: X-Bz-Content-Sha1
I tried to upload the logfile but apparently it is too large.
We actually do include the X-Bz-Content-Sha1 header in the request we are sending to BackBlaze B2. If we send it and B2 doesn't see it, the only reasonable explanation is that something between the two servers (your server and B2's server) is stripping the header.
That would be the transparent proxy server your host is using for outgoing HTTP/HTTPS connections.
Please contact your host and show them both the error message you are receiving and this reply of mine. Then do tell them that requests to all subdomains of backblazeb2.com and backblaze.com must NOT have any of their HTTP headers stripped or messed with. If their proxy does that the upload will of course fail (it will no longer be a valid request to the BackBlaze B2 API).
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!
Hi,
I understand what you are saying. I contacted Liquid Web. They replied:
"I have been looking, but I didn't see anything that should be stripping any of the headers yet. I did notice that both backblaze.com and backblazeb2.com are routed through CloudFlare, have you tried to see if this works properly when CloudFlare is disabled, so it isn't between the servers? Also, are any of your other domains using the Akeeba backups having these same issues? Please let me know, and I will be happy to keep helping."
The strange thing is that another site on the same server does still have Akeeba post processing to B2 working. Same version of Akeeba.
I compared the settings between the two sites, and the failing one was using zip format, while the one that is still successful is using jpa format. I have no idea if that would make any difference, but I changed the settings to make the failing site use jpa and a test backup now works there.
I will monitor and see if the scheduled backup works tomorrow.
The extension of the file name does not matter. We don't take it into account. We always upload the files as binary/octet-stream. It is possible that something on BackBlaze's side is stripping away the headers when they see a ZIP extension.
I believe this is a bug in B2's API. I can reproduce this locally. However, I see that we DO send all the headers! Here's what I see when I enable full verbosity on cURL when trying to make an upload:
* Trying 206.190.209.126:443... * Connected to pod-000-1102-15.backblaze.com (206.190.209.126) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * CAfile: <SITEROOT>/libraries/src/Http/Transport/cacert.pem * CApath: none * SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=backblaze.com * start date: Apr 28 07:51:02 2022 GMT * expire date: Jul 27 07:51:01 2022 GMT * subjectAltName: host "pod-000-1102-15.backblaze.com" matched cert's "*.backblaze.com" * issuer: C=US; O=Let's Encrypt; CN=R3 * SSL certificate verify ok. > POST /b2api/v1/b2_upload_file/e416a06d75150c1b5bf90a16/c001_v0001102_t0033 HTTP/1.1 Host: pod-000-1102-15.backblaze.com Transfer-Encoding: chunked Accept: application/json X-Bz-File-Name: test/test.zip Content-Type: application/octet-stream Content-Length: 262144 X-Bz-Content-Sha1: 255f3be6505f22e298cdbea7c5f427bc96692919 Authorization: <REDACTED> Expect: 100-continue * Mark bundle as not supporting multiuse < HTTP/1.1 400 < Cache-Control: max-age=0, no-cache, no-store < Content-Type: application/json;charset=utf-8 < Content-Length: 91 < Date: Mon, 16 May 2022 06:55:49 GMT < Connection: close < * Closing connection 0
It returns API Error bad_request: Missing header: Content-Length. Well, the header's there even though their API complains it's missing. The funny thing is that if I try the exact same code, unchanged, with another storage container on B2 which is handled by a different B2 storage pod I don't have this issue. So, clearly, something is wrong on B2's side.
That's all I can do on my end. Maybe try using a different storage engine?
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!
Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.
Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!