• Resolved mdelabb

    (@mdelabb)


    Hello, it seems that the SiteGround CDN is not caching images because the webp-converter-for-media (pro) is setting a Cache-Control: “private” header in the htaccess file. Is there a reason for this? And would I break anything if I just removed the lines that set this header?

    # BEGIN Converter for Media
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteOptions Inherit
    
    RewriteCond %{QUERY_STRING} original$
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule . - [L]
    
    RewriteCond %{HTTP_ACCEPT} image/avif
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.avif -f
    RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.avif [NC,T=image/avif,L]
    RewriteCond %{HTTP_ACCEPT} image/avif
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.avif -f
    RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.avif [NC,T=image/avif,L]
    RewriteCond %{HTTP_ACCEPT} image/avif
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.webp.avif -f
    RewriteRule (.+)\.webp$ /wp-content/uploads-webpc/$1.webp.avif [NC,T=image/avif,L]
    RewriteCond %{HTTP_ACCEPT} image/avif
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.avif -f
    RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.avif [NC,T=image/avif,L]
    
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
    RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.webp [NC,T=image/webp,L]
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
    RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [NC,T=image/webp,L]
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
    RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,L]
    </IfModule>
    <IfModule mod_headers.c>
    <FilesMatch "(?i)\.(jpg|png|webp|jpeg)(\.(webp|avif))?$">
    Header always set Cache-Control "private"
    Header append Vary "Accept"
    </FilesMatch>
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mdelabb

    (@mdelabb)

    I understand what this is needed for now and after consulting SiteGround support it seems that they do not support this yet, even for their premium customers. He suggested that they may be implementing this some time in the future but did not say when.

    I have therefore left the Cache-Control header as “private”.

    To be more specific, I am referring to the Vary: “Accept” header not being sent in the response, which is important for the correct delivery of images in various browsers and devices.

    • This reply was modified 6 months, 2 weeks ago by mdelabb.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @mdelabb,

    Thank you for your confirmation. Yes, you are right.

    If you encounter any other questions, please, feel free to reach out to me.

    Best,
    Mateusz

    Thread Starter mdelabb

    (@mdelabb)

    I have now set up the bunny CDN as per your recommendation in the documentation. I have followed the instructions on how to set up the vary configuration for browser avif and webp. What I am wondering is why I am not seeing a Vary header in the response and I am also not seeing any image/avif content-types. If I understand it correctly, then the media-converter plugin only works correctly with that header, correct?

    Can you confirm that “Vary: Accept” works and that the bunny CDN can also deliver image/avif? I enabled the Vary Cache for Browser WebP Support and Browser AVIF Support but I don’t see the appropriate headers. Or maybe I am just missing something.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @mdelabb From what I see, you are using a different plugin for image optimization because the URLs of your images have been changed – instead of .jpg extensions, there are .jpg.webp extensions. Our plugin does not change URLs to images, so when looking at the source of the website, you will see the URLs for the default images all the time. The plugin creates redirections to output files in WebP and AVIF format, changing the MIME type of these images, but without changing the URL.

    Below I have attached the tutorial describing how to test the plugin:
    https://mattplugins.com/docs/how-to-test-converter-for-media-plugin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘SiteGround CDN’ is closed to new replies.