Background image served via StackPath gives back 403 forbidden

Hello,
I have an issue using Cloudflare and Stackpath together.
I use SP to serve resources to my website via cookie free domain. If the most of the images are correctly loaded, the ones set as background images are not displayed correctly (I get a 403 forbidden).

Is there a way to solve this problem via Cloudflare?

Thank you!

You’re saying that most images on Stackpath don’t have a problem? It would sure help if there was a URL we could look at to troubleshoot this.

2 Likes

Hello sdayman,
sure, the url is https://palazzofiano.it, the main background image seems to be served directly from the origin domain and not from stakpack. You’ll see a white page, it’s the background image which is not correctly loaded.

Let me know!

Do you have ScrapeShield (No Image Hotlinking) enabled in the Cloudflare dashboard?

I see the request is blocked, and the referrer is a CSS file at Stackpath. That would be considered a Hotlink that would be blocked.

The other mystery is why that image isn’t on Stackpath. Whatever you’re using to configure Stackpath CDN isn’t routing that through the CDN.

Hello,
thank you for the quick reply.
No, I do not have this kind of option enabled…
Yes it’s really strange, I can’t figur it out…

Then it must be something on the server blocking the request.

Can you check the file permissions for that background image? I can get a different image (2020/01/planimetria_specchi02.png) from your domain with no issue.

If it’s set to Read for Owner/Group/World, then check server error logs for another possible cause.

Do you mean to check the image permissions on FTP?

Yes. However you inspect files in your account.

I have changed the file permissions to 777 but nothing happened… any other idea?

Strange thing is happened. The image appeared for few seconds and on other refresh it is disappeared again…

Hi,

When i just tried to access the site, i had the same problem, no background image and error 403 to get the image.
I tried to access it directly through the link
" palazzofiano.it/wp-content/uploads/2020/02/palazzofianoFOTO-1.jpg "

and successfully load it.

When i refresh the site, everything loaded normally, but it’s cached… meaning from different browser i still have the 403 error.

anyway hope this detail helps you.

Hi Rui,
yes, it’s the thing I’m trying to figure out.
The image is directly accessible but it’s not served by StackPath and it seems to be blocked

Anyone have any idea to solve this?

I doubt that this is related to Cloudflare. Let’s check that.

Pause Cloudflare for your domain or set your DNS records to :grey:, then wait five minutes, clear your browser cache and try again.

In case it persists, which i expect, follow this guide:

I doubted it too. I spoke with Stackpath support but they told me they couldn’t do anything by their side and to contact Cloudflare community for further info.
I already read the article, thank you for your support!

I will wait for any other help or ideas!

Thanks

You said it is disabled, but I am still pretty convinced it is the issue mentioned by @sdayman. The error message returned is pretty specific about that.

The problem is you are embedding that image via a CSS file loaded from Stackpath instead of your domain. Either you enable hotlinking or your change where you load the CSS file from.

Also, post a screenshot of https://dash.cloudflare.com/redirect?zone=content-protection

Hello sandro,
thank you for the reply. I said I never enabled that kind of option.
Just in case, where can I find it to check?


Ok, I found it! I disabled hotlinking and now it seems to work. The images are correctly displayed.
The only thing I do not understand why background images are the only ones not served by Stackpath. Is there a way to force it?

Here a screenshot:

1 Like

Exactly the issue @sdayman mentioned.

4 Likes