• Resolved Stormit

    (@stormit)


    Hi,

    I am having a problem with CDN. Our html likes below

    <div data-urls="url-1,url-2,url-3"></div>

    We use CDN (Generic Mirror) and enter CDN url. But, it only replaces the first url. Could you please check and fix this issue!

    Great plugin!

    Thank you very much!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stormit
    Thank you for your inquiry and I am happy to assist you with this.
    Can you please share some more details about this?
    Which CDN are you using? Are you using multisite?
    What is the expected behavior?
    Thanks!

    Thread Starter Stormit

    (@stormit)

    Hi @vmarko,

    I use keyCDN. I’m not using multisite.

    For example:
    – Our site url is: https://mysite.com/
    – Our CDN url is: mycdn.com (Zone URL)

    My image link: https://mysite.com/image-1.jpg will become https://mycdn.com/image-1.jpg

    My html is:

    <div data-urls="https://mysite.com/image-1.jpg,https://mysite.com/image-2.jpg,https://mysite.com/image-3.jpg"></div>

    Only the first url is replaced. It looks like below

    <div data-urls="https://mycdn.com/image-1.jpg,https://mysite.com/image-2.jpg,https://mysite.com/image-3.jpg"></div>

    Thank you very much!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stormit

    Thank you for the information.
    Can you please share your website URL so I can check this?
    Thanks!

    Thread Starter Stormit

    (@stormit)

    Hi @vmarko,

    You can check it here: https://demo.theme-sky.com/upstore-furniture/

    Link screenshot: https://prnt.sc/t6trf1

    Thank you very much!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Thread Starter Stormit

    (@stormit)

    Hi @vmarko,

    You may not understand what I want. I want all urls to be replaced by CDN. HTML should be:

    data-background_images="https://demothemesky-be87.kxcdn.com/upstore-furniture/wp-content/uploads/2018/04/bg-3.jpg,https://demothemesky-be87.kxcdn.com/upstore-furniture/wp-content/uploads/2018/04/bg-1.jpg,https://demothemesky-be87.kxcdn.com/upstore-furniture/wp-content/uploads/2018/04/bg-2.jpg,https://demothemesky-be87.kxcdn.com/upstore-furniture/wp-content/uploads/2018/04/bg-5.jpg,https://demothemesky-be87.kxcdn.com/upstore-furniture/wp-content/uploads/2018/04/bg-4.jpg"

    But your plugin only replaces the first URL. Please check it again!

    Best regards,

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stormit

    Those images are most likely added to your page by some JavaScript code. We cannot scan JS for image URLs and replace them, so that’s why they’re not loaded from the CDN.
    As you can see in the previous post, the images are uploaded to the CDN but because of the way they are added to your page they are not showing served from the CDN.
    Thanks!

    Thread Starter Stormit

    (@stormit)

    Hi @vmarko,

    They are not added by Javascript. They are added by PHP. Did you try adding it by yourself?

    I know images exist on CDN. But, your plugin does not replace all urls. So, it still loads images from our hosting. That is problem.

    Please check your plugin again!

    Thank you very much!

    • This reply was modified 4 years, 8 months ago by Stormit.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stormit

    Let me try to test and replicate this and I’ll get back to you with the results.
    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stormit

    Thank you for your patience. We checked and tested this and this only happens when those are delivered by js/ajax.
    These images should dynamically after the page is processed by W3TC. Your server sends the fully-composed HTML back to the browser and then the JavaScript executes and downloads those files from your primary domain.
    There’s a hook, in that case, to add to the code generating content: wp_prepare_attachment_for_js

    You can also try changing the URLs for those images manually to use the CDN version.
    Thank you!

    Thread Starter Stormit

    (@stormit)

    Hi @vmarko,

    As I said they are not added by JS. They are added by PHP. Don’t care about loading images after page is loaded. It just read image urls in data-background_images and load images based on those urls. But all urls in data-background_images are not replaced. Only the first url is replaced. They are replaced by your plugin. That is why I contacted you :). Please check again!

    Thank you very much!

    • This reply was modified 4 years, 8 months ago by Stormit.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘CDN – List URLs’ is closed to new replies.