• Resolved rudolfl

    (@rudolfl)


    I am having a problem where autooptmised files are not being cached by CDN (BunnyCDN) in my case.

    https://gtmetrix.com/reports/www.hatsfromoz.com.au/SC0YeXBD/

    It feels like they are just not being picked up by CDN plugin, while the rest of the CSS and JS files are.

    Would you have any idea what can be wrong?
    How are “autooptimised” files loaded? with wp_enqueue_script()/wp_enqueue_style()?

    Thanks,
    Rudolf

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

    (@optimizingmatters)

    Can you try adding the bunny root CDN to the Autoptimize CDN settings?

    Thread Starter rudolfl

    (@rudolfl)

    Thank you for the suggestion.

    Yes, I tried both ways — with and without root CDN in the settings. Same

    Rudolf

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    can you set the cdn-field in AO to https://hatsfromoz.b-cdn.net/ so I can take a look at your site in that state?

    Thread Starter rudolfl

    (@rudolfl)

    Done.

    CDN field in AO set to https://hatsfromoz.b-cdn.net/

    Thank you,
    Rudolf

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, can you clear W3TC’s cache?

    Thread Starter rudolfl

    (@rudolfl)

    Done.

    I also tried to disable nginx server that is running as a proxy. Result is same. nginx is back on now.

    Rudolf

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    weird … afraid I have no idea why this is not working Rudolf, I would suspect a conflict somewhere with another plugin or something. could have to do with the fact you have content instead of wp-content, although AO normally is OK with such changes (if done right) .. :-/

    Thread Starter rudolfl

    (@rudolfl)

    How does AO includes optimised scripts?
    Or, rather, where in the code does it do so?

    I have development experience, so will try to spread some debug in both AO and bunnyCDN plugins to hopefully figure it out

    Rudolf

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    It hooks into template_redirect and catches all HTML in an output buffer, extracting all links to JS & CSS, combining them and re-inserting the optimized URL’s, returning the optimized HTML at the end.

    Thread Starter rudolfl

    (@rudolfl)

    When do you finish the output? Can’t find the place.

    What I see is:
    AO hooks into template_redirect
    AO starts capturing the buffer

    BunnyCDN hooks into template_redirect
    AO callback “end_buffering” is called.

    AO template_redirect runs at default ptiority of 2, BunnyCDN runs at 10. So should be OK, but seem that bunnyCDN tried to process HTMP before AO finished with it!

    Dumping HTML received by bunnyCDN action confirms my suspicions — there is no autoptimised files in it.

    Rudolf

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    At the end of the end_buffering function; https://github.com/futtta/autoptimize/blob/beta/classes/autoptimizeMain.php#L532

    I would be kind of surprised this is related to output buffering & co, as AO is able to optimize the JS/ CSS and insert the links to the optimized files. the CDN-stuff is an inherent part of that logic as it’s called in the cache method of the respective optimizers, e.g. https://github.com/futtta/autoptimize/blob/cf716beec06f8b38b514aa2da74f302ea9b3e37b/classes/autoptimizeScripts.php#L572 ?

    Thread Starter rudolfl

    (@rudolfl)

    Hi,

    Even putting debugging around your code, seems that replacement of URL with CDN happens AFTER data is output. Does not make sense!

    I actually have another site with same combinations of plugins and they work quite happily together.

    I now created a staging site for experiments. Disabled W3 cache completely and created new BunnyCDN account to play with.

    I tried to disable all plugins (except Autoptimise and bunnyCDN) and switched to TwenyTwentyOne theme. Problem is still there.

    Can I give you access? I am running out of ideas here

    Thanks,
    Rudolf

    • This reply was modified 4 years ago by rudolfl.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you can contact me at futtta-at-gmail-dot-com ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Autooptimize + BunnyCDN’ is closed to new replies.