Images from BackBlaze by b2 CNAME not working more in the staging enviroment

What is the name of the domain?

https://cognittron-staging.fly.dev/

What is the error number?

403

What is the error message?

nothing

What is the issue you’re encountering

Images from BackBlaze by b2 CNAME not working more in the staging enviroment

What steps have you taken to resolve the issue?

Load the website and the images not are loaded

What are the steps to reproduce the issue?

Images from BackBlaze by b2 CNAME not working more in the staging enviroment

Hi there - I’m Pat Patterson, Chief Technical Evangelist at Backblaze. I might be able to help figure this out…

  • Was this working earlier?
  • Did you change anything when it stopped working?
  • Is the Backblaze B2 bucket public or private?
  • Are you using a Cloudflare Worker to access the bucket?
  • Can you provide the URL to a file that should work?
2 Likes

Hi,

Yes, it was working before. We haven’t changed anything about Blackbaze or Cloudflare. All buckets are public. We are only using the b2 CNAME for “f005.backblazeb2.com”. See this example:


The image loads normally, but in our app, it doesn’t:

https://cognittron-staging .fly.dev/learn

It used to load, but since we don’t have any domain configured for staging, we use this fly subdomain, but it doesn’t work. We have another instance “plataforma.superfoco.com.br”, where I had to change all the images to make it work. to something like this “b2.superfoco.com.br/file/superfoco-public/images/T02-thumb.webp”. But this is not the temporary solution I found it does not break in production, but not loading these images complicates the test locally, and also have other project members test things on staging. I believe it is a Cors issue or something like that, but in Blackblaze everything is configured correctly with “Share everything in this bucket with all origins”.

I don’t know how to edit my reply, so:

The correct is:

“But this is the temporary solution I found it does not break in production”

And the example image:

https://b2.unicte.com/file/unicte-public/trail_icons/pontos-criticos_armadilhas-sistemas-prediais_rectangle_1703620899626.jpeg

Another example is our website: UniCTE

Some images do not load because are with the link b2.unicte.com:

But this is the staging of Cloudflare, it does not make sense not wok.

I can retrieve https://b2.unicte.com/file/unicte-public/trail_icons/pontos-criticos_armadilhas-sistemas-prediais_rectangle_1703620899626.jpeg via curl at the command-line just fine:

% curl -i https://b2.unicte.com/file/unicte-public/trail_icons/pontos-criticos_armadilhas-sistemas-prediais_rectangle_1703620899626.jpeg
HTTP/2 200 
date: Fri, 16 Aug 2024 16:19:25 GMT
content-type: image/jpeg
content-length: 8186
x-bz-file-name: trail_icons/pontos-criticos_armadilhas-sistemas-prediais_rectangle_1703620899626.jpeg
x-bz-file-id: 4_z1025417dd062ddcf88aa0d17_f1158dd48bd16b55a_d20231226_m200140_c005_v0501013_t0033_u01703620900054
x-bz-content-sha1: unverified:a5a0e44c6b1851ca47fa05fcc4019d13459da617
x-bz-upload-timestamp: 1703620900054
content-encoding: base64
strict-transport-security: max-age=63072000
cache-control: max-age=14400
cf-cache-status: EXPIRED
last-modified: Fri, 16 Aug 2024 16:19:25 GMT
accept-ranges: bytes
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=v6fROu9BPKSCRE%2Fk8SPJP7BWfAryTri2mpGUxBwFu4AFge%2F%2BW2EGbECFWZY78Mqsaq%2FjWFNIKAHKiYBqYYEaKySsGG0clrX6us%2F4xi9UwHZFZw6m1o%2BMB%2Fy4IB5pfK2z"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 8b42beea9dc61694-SJC
alt-svc: h3=":443"; ma=86400

Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

But when I try to open it in the browser (in a new tab), I get this error:

So, it looks like you have enabled Hotlink Protection. Any requests that contain a Referer HTTP header that does not begin with https://b2.unicte.com/ will be denied with this error. You can simulate this with curl like this:

% curl -i https://b2.unicte.com/file/unicte-public/trail_icons/pontos-criticos_armadilhas-sistemas-prediais_rectangle_1703620899626.jpeg -H 'Referer: https://staging.unicte.pages.dev/'
HTTP/2 403 
date: Fri, 16 Aug 2024 16:26:21 GMT
content-type: text/plain; charset=UTF-8
content-length: 16
vary: Referer
x-frame-options: SAMEORIGIN
referrer-policy: same-origin
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=yocYMThSLnoZYa2PekYoR%2FlwsqjfOz75CGgA%2BoHzwDaNH1F4Tlg9NA6xteaF5T3r1lBmeAA4BTry37HsxtK3vRIACC6DI4zaapYEZURf%2BRI8crwcpHUrqV2wlhL0iYXZ"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 8b42c91b3d8967f1-SJC
alt-svc: h3=":443"; ma=86400

error code: 1011

Turn off Hotlink Protection, and it should work.

Thanks, It’s right, I turn off the hotlink protection and the images are loading again.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.