Fix Backblaze B2 Redirect Issues
About 379 words
Learn how to fix redirect issues when using Backblaze B2 as your storage backend.
Problem
When accessing your StaticPages site backed by Backblaze B2, you experience:
- Browser redirects to
backblaze.com - HTTP 404 errors for valid pages
- Logs showing "no valid path found after testing all options"
Solution
Add the /file/ prefix to your proxy.path configuration.
Steps
Open your StaticPages configuration file (e.g.,
values.yamlfor Helm deployments)Locate your page configuration with Backblaze B2
Update the
proxy.pathto includefile/prefix:pages: - domain: your-domain.com bucket: region: eu-central-003 url: https://s3.eu-central-003.backblazeb2.com name: your-bucket applicationId: ENV(APPLICATION_ID) secret: ENV(S3_SECRET) proxy: url: https://cdn.your-domain.com # or https://f003.backblazeb2.com path: file/your-bucket # Add 'file/' prefix here notFound: 404.html searchPath: - /index.html - /index.htmApply the configuration:
Apply updated Backblaze configuration# For Helm deployments helm upgrade staticpages spechtlabs/staticpages -f values.yaml -n static-pages # For direct deployments kubectl rollout restart deployment/staticpages -n static-pagesVerify the fix by checking your logs:
Verify proxy logskubectl logs -n static-pages deployment/staticpages | grep "proxying request"You should see paths like
/file/your-bucket/...instead of/your-bucket/...
Why This Works
Backblaze B2 requires all public file URLs to follow this structure:
https://{endpoint}/file/{bucket-name}/{file-path}
^^^^^
This prefix is requiredThe /file/ prefix tells Backblaze B2 to serve a file from a bucket. Without it, Backblaze returns its homepage, causing the redirect.
This requirement applies even when using:
- A CNAME pointing to Backblaze
- A CDN (like CloudFlare) proxying to Backblaze
- Any custom domain that ultimately routes to Backblaze B2
Verify It's Working
Check Your Logs
Look for "proxying request" entries with correct paths:
{
"level": "info",
"msg": "proxying request",
"backend_path": "/file/your-bucket/repo/sha/index.html"
}Test Manually
Verify your files are accessible:
# This should return your file
curl https://f003.backblazeb2.com/file/your-bucket/path/to/file.html
# This will redirect to Backblaze homepage
curl https://f003.backblazeb2.com/your-bucket/path/to/file.htmlRelated Issues
- If you're still experiencing issues, see Troubleshoot Path Resolution(Open in new window)
- For CloudFlare-specific issues, see Understanding Proxy Origin Bypass
- For general configuration, see Backblaze B2 Configuration Reference
