Uploads to b2 fail with HTTP 400

Self hosting based upon the official documentation and it appeared to function fine for a while. My CORS configuration is as documented, is there any other configuration backblaze requires?
2 Replies
Ducky
Ducky2mo ago
If you are encountering a CORS error and cannot upload photos, you may need to fix your bucket's CORS configuration. Use the content provided in the documentation for creating a cors.json file, which can be found at https://help.ente.io/self-hosting/administration/object-storage#cors-cross-origin-resource-sharing. You may have to change the AllowedOrigins to allow only certain origins (your Ente web apps and Museum) for security. Assuming you have AWS CLI on your system and that you have configured it with your access key and secret, you can execute the below command to set bucket CORS. Make sure to enter the right path for the cors.json file:
aws s3api put-bucket-cors --bucket YOUR_S3_BUCKET --cors-configuration /path/to/cors.json
aws s3api put-bucket-cors --bucket YOUR_S3_BUCKET --cors-configuration /path/to/cors.json
-# If your issue is resolved, feel free to use the /solved command to close this thread. If you'd like to ask me another question use /docsearch
Configuring Object Storage - Self-hosting | Ente Help
Configure Object Storage for storing files along with some troubleshooting tips
TheMachine
TheMachine2mo ago
I used the b2-windows tool from Backblaze https://www.backblaze.com/docs/cloud-storage-command-line-tools and had to set my cors using the following command: b2-windows.exe bucket update --cors-rules "[{\"corsRuleName\":\"downloadFromAnyOrigin\",\"allowedOrigins\":[\"*\"],\"allowedHeaders\":[\"*\"],\"allowedOperations\":[\"s3_get\",\"s3_post\",\"s3_put\",\"s3_head\"],\"maxAgeSeconds\":3000,\"exposeHeaders\":[\"Etag\"]}]" bucket allPrivate You would need to authorize your account first, and change bucket to your bucket name in the command. I am also not sure the allowedOperations are the right commands (they seem to work), as Backblaze's documentation isn't so great.
Install the Backblaze B2 Command-Line Tool
Command-line tools provide easy access to the capabilities of Backblaze B2 Cloud Storage.

Did you find this page helpful?