Support » Plugin: LiteSpeed Cache » Caching Logged-in Users

  • Resolved crpeng

    (@crpeng)


    I noticed that for logged-in users (admin), I always get this is Profiler:

    cache-control: no-cache, must-revalidate, max-age=0

    This causes some FOUC. I have enabled Cache Logged-in Users. And I have verified my LiteSpeed server version is 5.4

    Users who are not logged-in received cache version properly.

    How do I serve cached contents to logged-in users as well?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • This header has nothing to do with LScache plugin for WordPress.This header is for browser caching and is controlled either by WP itself or has manually been set in .htaccess. Normally this header is used for static sources like CSS, Javascript. If you want to verfify if LScache plugin works check response headers for:

    x-litespeed-cache: hit or miss

    If you have any dysfunction check your Cloudflare settings. Cloudflare may cause it.

    Thread Starter crpeng

    (@crpeng)

    x-litespeed-cache-control: no-cache,esi=on

    The above is found for logged-in user (admin)

    While logged-out user gets a hit.

    Meanwhile, CloudFlare development mode has already been turned on.

    Thank you.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    cache-control: no-cache, must-revalidate, max-age=0

    this is browser cache header, and it is default value for WP

    I am not sure how would this cause FOUC ?

    x-litespeed-cache-control: no-cache,esi=on

    this usually happens during user first access, after that it should be cache hit if you have enabled cache login user

    Best regards,

    Thread Starter crpeng

    (@crpeng)

    For the time being, let’s ignore the FOUC issue first, because I went through a lengthy session with support, we never really got to the bottom of it.

    However, I eventually discovered FOUC doesn’t happen to users who are not logged in. It seems to only happen to logged in users. Which led me to investigate caching.

    If I am logged in, visit a page for the first time, there should be no cache version. That I understand.

    However, should I be getting a cached version when I refresh? I don’t think I am getting a cached version because I see this

    x-litespeed-cache-control: no-cache,esi=on

    or

    x-litespeed-cache-control: miss

    Please advise. Thank you

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

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

    after that , you can follow this guide to enable debug log and see if it says anything for why not caching the login user

    Best regards,

    Thread Starter crpeng

    (@crpeng)

    Report sent. And I followed the guide and discovered something interesting. The cache wasn’t happening due to an item in cart (I didn’t realize it was there). I removed the item, and caching hit, for both logged-in and logged-out users.

    Later, when I add items into cart, caching continues to work. I really don’t understand what happened before, but all seems fine. I no longer get FOUC when logged in.

    If you can provide a guess of what happened, that’d be great. If you can’t guess, it’s fine too. All good now.

    Thank you very much for the tip.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    well, if you can reproduce the issue , check the debug log , it should always tell something useful , if you are not sure what it means, you can post it here , we will interpret it for you

    Best regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.