• Resolved Karis

    (@askel45)


    1. How do I bypass CDN on frontend and backend when logged in? I was applying some styles to my site and they only showed up when I remembered to bypass CDN in the quic CDN settings.
    2. Is there a button to flash CDN cache from the LSC plugin?

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    1. backend doesn’t have CDN, for front-end , you can try use this code

    if ( is_user_logged_in() ) {
    define( 'LITESPEED_BYPASS_CDN', true ) ;
    }

    this will check login and bypass CDN when it is true.

    2. depends , currently LSCWP only has CloudFlare API , so for now it can only purge CF cache by a “button”

    Best regards,

    Thread Starter Karis

    (@askel45)

    1. thanks
    2. for Quic.cloud would also help.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    If you enabled QC API , then it will act like normal LiteSpeed Cache on your local server, purge all will also purge QC node

    Best regards,

    Thread Starter Karis

    (@askel45)

    1. The code above triggered an error on my site.
    2. I did enable the API. Good to know

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Where you put ?

    Thread Starter Karis

    (@askel45)

    I put it in a custom plugin I use for PHP at the end.

    Thread Starter Karis

    (@askel45)

    Resolved by adding function bypass_cdn() {code_here}

    Thread Starter Karis

    (@askel45)

    Correction: Still the CDN is not being bypassed. Inserting the initial code inside wp-config.php causes the site to go down.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    wp-config.php will break because is_user_loggin_in function is create AFTER it , it will give you error as that function is not defined.

    you need to put it somewhere like theme’s functions.php

    Best regards,

    • This reply was modified 5 years, 7 months ago by qtwrk.
    Thread Starter Karis

    (@askel45)

    @qtwrk As I said, putting the code ‘as is’ in my custom plugin broke the site. Same applies to functions.php. Even adding a function as I specified did not seem to work. Or do I need to clear my browser cache? Even CTRL+F5 did not seem to do the work.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try add it at top of functions.php

    I have tested that before I replied you , and it works on my test site.

    Best regards,

    Thread Starter Karis

    (@askel45)

    I did apply to functions.php ‘as is’ but I want it in my custom plugin. Seems wrapping the code in after_setup_theme function in the plugin worked. But now, in both cases, there is an issue. I tried changing some CSS and pressing CTRL+F5 when logged in showed me the CSS worked. But when I reverted the CSS change and then forced a hard refresh again, nothing happened until I had to flush the CDN cache again!

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    if you have CSS combine/minify enabled , you need to purge CSS in case to generate new files

    by CDN you meant QC or other CDN ?

    Best regards,

    Thread Starter Karis

    (@askel45)

    It is QC I am referring to. I should have mentioned that I have disabled page optimization for administrator and I saw any changes I made automatically or if I forced a refresh (like for CSS changes). But even when bypassing CDN as mentioned above seems to still affect the site as mentioned in the previous topic.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    yes, I see now ,that code won’t bypass QC , as it is on DNS level.

    .when you do purge all , or plugin does a purge all, it won’t purge static resources on QC.

    but if you have LSCWP CSS minify/combine enabled , it will generate a new query each time you purge to avoid staled content, you may wanna give it a try

    Best regards,

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Bypass CDN when logged in’ is closed to new replies.