Support » Plugin: LiteSpeed Cache » images in post not via cdn, but other images are

  • Resolved Wendihihihi

    (@wendihihihi)


    Hi,

    I don’t know how to solve this. The featured images and images anywhere else are served via cdn, but when I use this in a post, the images are not going via cdn.

    <img loading="lazy" class="pure-img" src="http://www.domain.com/wp-content/uploads/image-step1.jpg" sizes="(max-width: 480px) 100vw, 480px" srcset="http://www.domain.com/wp-content/uploads/image-step1.jpg 480w, http://www.domain.com/wp-content/uploads/image-step1-360x360.jpg 360w, http://www.domain.com/wp-content/uploads/image-step1-300x300.jpg 300w" alt="recipe image step 1" width="480" height="480">

    How can I change this?

    Report number: YNNLADPY

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter Wendihihihi

    (@wendihihihi)

    I changed the order of the img tag and now I’m getting this

    <img width="480" height="480" src="https://cdn.com/dk/wp-content/uploads/image-step1.jpg" class="pure-img wp-post-image" alt="recipe image Step 1" loading="lazy" srcset="http://www.domain.com/wp-content/uploads/image-step1.jpg 480w, http://www.domain.com/wp-content/uploads/image-step1-360x360.jpg 360w, http://www.domain.com/wp-content/uploads/image-step1-300x300.jpg 300w" sizes="(max-width: 480px) 100vw, 480px">

    Note the scr url has changed to the cdn but the scrset hasn’t.

    Thread Starter Wendihihihi

    (@wendihihihi)

    An example page is this page

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please provide the report number , you can get it in toolbox -> report -> click “send to LiteSpeed”

    Best regards,

    Thread Starter Wendihihihi

    (@wendihihihi)

    You missed it. Look above.

    Report number: YNNLADPY

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    oh yes , my bad

    I don’t see any immediate reason why it won’t work

    please try :

    export your current setting , then reset to default and only enable CDN rewrite

    after that , enable the debug log , it should log out what exactly was happened

    Best regards,

    Thread Starter Wendihihihi

    (@wendihihihi)

    Okay thanks. I’ll try it soon.

    Thread Starter Wendihihihi

    (@wendihihihi)

    I tried and created a log but none of the srcset images showed up in the log. Only the src image.

    This is part of the log file. The images that are not showing up are the step1, step2 etc. images. Only the ones in the src show up.

    No clue how to go from here.

    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] 💓 ------GET HTTP/1.1 /sample-image
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] Query String:
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] HTTP_REFERER: http://www.domain.com/
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] Accept Encoding: gzip, deflate
    12/11/21 05:38:10.155 [9.8.7.6:7895 1 ITA] X-LSCACHE: true
    12/11/21 05:38:10.395 [9.8.7.6:7895 1 ITA] [Router] get_role:
    12/11/21 05:38:10.395 [9.8.7.6:7895 1 ITA] [Media] init
    12/11/21 05:38:10.396 [9.8.7.6:7895 1 ITA] [LQIP] init
    12/11/21 05:38:10.397 [9.8.7.6:7895 1 ITA] [Optm] init
    12/11/21 05:38:10.397 [9.8.7.6:7895 1 ITA] [CDN] init
    12/11/21 05:38:10.397 [9.8.7.6:7895 1 ITA] [CDN] mapping inc_img -> https://cdn-domain.com/dk/
    12/11/21 05:38:10.398 [9.8.7.6:7895 1 ITA] ⏰ Task init
    12/11/21 05:38:10.398 [9.8.7.6:7895 1 ITA] [Router] LSCWP_CTRL bypassed empty
    12/11/21 05:38:10.399 [9.8.7.6:7895 1 ITA] [GUI] init
    12/11/21 05:38:10.484 [9.8.7.6:7895 1 ITA] 💰 [Tag] Add --- HTTP.200
    12/11/21 05:38:10.484 [9.8.7.6:7895 1 ITA] [Ctrl] X Cache_control init on
    12/11/21 05:38:10.498 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.499 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.499 [9.8.7.6:7895 1 ITA] [CDN] rewrite https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.500 [9.8.7.6:7895 1 ITA] [CDN] -rewrite failed: host not internal
    12/11/21 05:38:10.501 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.501 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.548 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.548 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.548 [9.8.7.6:7895 1 ITA] [CDN] rewrite https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.549 [9.8.7.6:7895 1 ITA] [CDN] -rewrite failed: host not internal
    12/11/21 05:38:10.549 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.549 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.550 [9.8.7.6:7895 1 ITA] [CDN] rewrite https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.550 [9.8.7.6:7895 1 ITA] [CDN] -rewrite failed: host not internal
    12/11/21 05:38:10.551 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.551 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.551 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-360x240.jpg
    12/11/21 05:38:10.551 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-360x240.jpg
    12/11/21 05:38:10.552 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-300x200.jpg
    12/11/21 05:38:10.552 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-300x200.jpg
    12/11/21 05:38:10.552 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-420x280.jpg
    12/11/21 05:38:10.553 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-420x280.jpg
    
    12/11/21 05:38:10.646 [9.8.7.6:7895 1 ITA] [Core] Footer hook called
    12/11/21 05:38:10.648 [9.8.7.6:7895 1 ITA] [Core] Footer check passed
    12/11/21 05:38:10.649 [9.8.7.6:7895 1 ITA] [Router] get_role:
    12/11/21 05:38:10.649 [9.8.7.6:7895 1 ITA] [Router] get_role:
    12/11/21 05:38:10.650 [9.8.7.6:7895 1 ITA] [Vary] role id: failed, guest
    12/11/21 05:38:10.650 [9.8.7.6:7895 1 ITA] [Router] get_role:
    12/11/21 05:38:10.651 [9.8.7.6:7895 1 ITA] [Router] get_role:
    12/11/21 05:38:10.651 [9.8.7.6:7895 1 ITA] [Vary] no custimzed vary
    12/11/21 05:38:10.652 [9.8.7.6:7895 1 ITA] 💰 X-LiteSpeed-Cache-Control: public,max-age=604800
    12/11/21 05:38:10.652 [9.8.7.6:7895 1 ITA] 💰 X-LiteSpeed-Tag: 2d7_HTTP.200,2d7_post,2d7_URL./sample-image/,2d7_Po.18589,2d7_
    12/11/21 05:38:10.653 [9.8.7.6:7895 1 ITA] [Core] Footer check passed
    12/11/21 05:38:10.653 [9.8.7.6:7895 1 ITA] [Media] finalize
    12/11/21 05:38:10.654 [9.8.7.6:7895 1 ITA] GUI bypassed by no counter
    12/11/21 05:38:10.654 [9.8.7.6:7895 1 ITA] [Optm] start
    12/11/21 05:38:10.655 [9.8.7.6:7895 1 ITA] CDN _finalize
    
    12/11/21 05:38:10.661 [9.8.7.6:7895 1 ITA] [CDN] rewrite https://cdn-domain.com/dk/wp-content/uploads/sample-image.jpg
    12/11/21 05:38:10.662 [9.8.7.6:7895 1 ITA] [CDN] -rewrite failed: host not internal
    12/11/21 05:38:10.662 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-step1.jpg
    12/11/21 05:38:10.663 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-step1.jpg
    12/11/21 05:38:10.663 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-step2.jpg
    12/11/21 05:38:10.664 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-step2.jpg
    12/11/21 05:38:10.664 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-step3.jpg
    12/11/21 05:38:10.665 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-step3.jpg
    12/11/21 05:38:10.666 [9.8.7.6:7895 1 ITA] [CDN] rewrite http://www.domain.com/wp-content/uploads/sample-image-step4.jpg
    12/11/21 05:38:10.666 [9.8.7.6:7895 1 ITA] [CDN] -rewritten: https://cdn-domain.com/dk/wp-content/uploads/sample-image-step4.jpg
    
    12/11/21 05:38:10.679 [9.8.7.6:7895 1 ITA] [CDN] _replace_inline_css --- array (
    'inc_img' => 'https://cdn-domain.com/dk/',
    )
    12/11/21 05:38:10.680 [9.8.7.6:7895 1 ITA] End response
    --------------------------------------------------------------------------------
    
    • This reply was modified 8 months, 1 week ago by Wendihihihi.
    Plugin Support qtwrk

    (@qtwrk)

    is it same page where you mentioned in first topic as you did for debug log ?

    I don’t see them showing in the log [CDN] section ?

    Thread Starter Wendihihihi

    (@wendihihihi)

    Yes it’s the same page. I was also surprised. It’s only logging and changing the src image, not the srcset images.

    All images were added via the Add Media button and the images were added to the post by adding the code, not via Insert into Post button.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    okay , add this into your theme’s functions.php

    function get_html_source( $content ) {
        error_log($content,3,"/xxx/lscwp.log");
      return $content;
    }
    add_filter( 'litespeed_buffer_before', 'get_html_source', 0);

    replace /xxx/lscwp.log to your public_html path

    then access an uncached page , this should log out the HTML source code BEFORE it is manipulated by LSCWP, see how it shows about these images in question

    Best regards,

    Thread Starter Wendihihihi

    (@wendihihihi)

    Hi,

    when I look at the code in the log file I see what I see when I look at the source code as an admin. All links to the images are there. All domain urls are not the cdn ones.

    <img width="480" height="480" src="http://www.domain.com/wp-content/uploads/image-step1.jpg" class="pure-img wp-post-image" alt="recipe image Step 1" loading="lazy" srcset="http://www.domain.com/wp-content/uploads/image-step1.jpg 480w, http://www.domain.com/wp-content/uploads/image-step1-360x360.jpg 360w, http://www.domain.com/wp-content/uploads/image-step1-300x300.jpg 300w" sizes="(max-width: 480px) 100vw, 480px">

    Thread Starter Wendihihihi

    (@wendihihihi)

    This is only for WebP images, right?

    WebP For Extra srcset¶
    OFF

    If you have custom code on your site, and it adds srcset elements but it bypasses WordPress logic to do so, you’ll need this setting turned ON. LiteSpeed knows to look for srcset elements that are generated through WordPress, but it won’t replace WebP images in other srcset elements unless you tell it to.

    Thread Starter Wendihihihi

    (@wendihihihi)

    Adding .srcset to HTML Attribute To Replace also didn’t work

    Thread Starter Wendihihihi

    (@wendihihihi)

    Any reply?

    Thread Starter Wendihihihi

    (@wendihihihi)

    Thank you for your help

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘images in post not via cdn, but other images are’ is closed to new replies.