Join the community today
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 Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    6:44 AM
    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 Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    6:44 AM
    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,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:44 PM
    Mainline
    10.2
    That's the right thing to do, Yes.
     
  4. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:44 PM
    Mainline
    10.2
    Mine

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

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yup @rdan approach would be the easiest via a custom Cloudflare page rule :)
     
  6. Rake-GH

    Rake-GH Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    6:44 AM
    default
    default
    I just wanted to note that this firewall rule makes paid account upgrades fail on my website:
    upload_2022-1-16_22-4-26.png

    So if you ever run into trouble with registrations, try disabling this rule.

    Sounds crazy, but it's true, hope it helps someone so they don't have to debug as long as I did to find the problem
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    CF Firewall rule or Page rule? That looks like CF Page rule to me.
     
  8. Rake-GH

    Rake-GH Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    6:44 AM
    default
    default
    Page rule, that was a typo
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    I see, still don't see how css.php caching prevented user upgrades though. What errors did you get with that Page rule in place?