Want to subscribe to topics you're interested in?
Become a Member

Cloudflare Cloudflare not caching images & Polish not working

Discussion in 'Web Development & Web Performance' started by Rake-GH, May 26, 2021.

  1. Rake-GH

    Rake-GH Premium Member Premium Member

    174
    90
    28
    Jul 29, 2019
    USA
    Ratings:
    +138
    Local Time:
    8:50 PM
    default
    default
    I had some questions regarding images not being cached by CF and some Polish confusion, and I figured this is the best place to ask.

    I was just poking around in Cloudflare and noticed this:
    upload_2021-5-25_16-14-7.png
    I thought it was weird that these are being served by the origin, even weirder that the content type is empty.


    Then I realized, 99% of my images on the site are all attachments. None of the attachments are being served as webp despite using Polish? Yikes, how did I never realize this before.

    I found this: Getting proxy images to work well with CloudFlare compression (Polish) and this Getting proxy images to work well with CloudFlare compression (Polish)

    There doesn't seem to be any simple way to solve this problem.

    Any thoughts or advice? Thank you in advance
     
  2. Rake-GH

    Rake-GH Premium Member Premium Member

    174
    90
    28
    Jul 29, 2019
    USA
    Ratings:
    +138
    Local Time:
    8:50 PM
    default
    default
    I was just thinking, I can probably cache the image attachments on the CDN at least by making a page rule, something like:

    if uri.contains(/attachments/*-png.*) then cacheLevel = standard

    does that sound like a decent idea?
     
  3. rdan

    rdan Well-Known Member

    5,100
    1,264
    113
    May 25, 2014
    Ratings:
    +1,931
    Local Time:
    9:50 AM
    Mainline
    10.2
    That's the right thing to do, Yes.
     
  4. rdan

    rdan Well-Known Member

    5,100
    1,264
    113
    May 25, 2014
    Ratings:
    +1,931
    Local Time:
    9:50 AM
    Mainline
    10.2
    Mine

    upload_2021-5-26_5-7-8.png
     
  5. eva2000

    eva2000 Administrator Staff Member

    47,461
    10,759
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,715
    Local Time:
    11:50 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Yup @rdan approach would be the easiest via a custom Cloudflare page rule :)