• Resolved jasonbear

    (@jasonbear)


    How do I get the “CDN Base URL” to work properly with the JS and CSS files that Autoptimize generates? When I enter my CDN Base URL (https://*****.sirv.com/) on the settings page, Autoptimize uses:

    https://*****-cdn.sirv.com/**********/wp-content/cache/autoptimize/css/autoptimize_245a6b0db571c66994bcb974996f39b1.css
    and
    https://*****-cdn.sirv.com/**********/wp-content/cache/autoptimize/js/autoptimize_dac323a6bde9ae42c82aa028fd7e29f9.js

    instead of the desired

    https://*****-cdn.sirv.com/css/autoptimize_245a6b0db571c66994bcb974996f39b1.css
    and
    https://*****-cdn.sirv.com/js/autoptimize_dac323a6bde9ae42c82aa028fd7e29f9.js

    How do I fix this? Do I have to manually create a matching directory structure (/wp-content/cache/autoptimize/js/) at my CDN? I’m having trouble understanding how this works because–unlike an image–the name of Autoptimize’s JS file is always changing.

    Thank you in advance for your help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    AO indeed expects the path on the CDN to be identical to the one on the origin site Jason, so you would need to the map filesystem structure.

    re. name always changing; AO expects a “pull CDN”, where the CDN upon receiving a request for a file it does not have to contact to origin site, retrieve and cache it.

    hope this clarifies,
    frank

    Before you add your CDN Base URL (https://*****-cdn.sirv.com/) on the Autoptimize settings page, you should have enabled remote fetching in your Sirv account.

    1. Go to your Sirv settings page:

    https://my.sirv.com/#/account/settings

    2. In the Auto-Fetch section, enter your domain name:

    3. Click Save, then go to your Autoptimize settings and enter your CDN Base URL (https://*****-cdn.sirv.com/).

    You might also like to personalize your CDN base URL to a subdomain of your own domain e.g. cdn.your-website.com. You can also do that on your Sirv settings page above.

    Please reply if you need any help.

    David

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thanks for your assistance, great customer service David!

    The accepted answer in this thread is related to some “Sirv” thing. How about the rest of us, who don’t use Sirv — I’d really like the original pull to be customizable to a URL.

    An auto-generated link this defeats the purpose of a CDN-

    //cdn.example.com/wp-content/cache/autoptimize/css/autoptimize_2f9beafea86ab0f5c867e59c87c6c63d.css

    This is so much cleaner:

    //cdn.example.com/css/autoptimize_2f9beafea86ab0f5c867e59c87c6c63d.css

    We can set up origin pull directly to the autoptimize folder (/wp-content/cache/autoptimize/) and expect the CDN urls to be generated accordingly. Please let me know if this is possible, or do we have to look for another plugin?

    Thanks.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Yeah, this is about SIRV, you’d be better off starting your own topic really :-p

    But now that we’re here; if you know a bit of PHP you could hook into AO’s API to make //cdn.example.com/css/autoptimize_2f9beafea86ab0f5c867e59c87c6c63d.css possible (assuming you set up the pull stuff), but this is not supported “out of the box” no. Feel free to look for another plugin though, I wouldn’t want you to feel unhappy or anything ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem using “CDN Base URL” for CSS and JS files’ is closed to new replies.