• Resolved hagenb

    (@hagenb)


    Apologies for the long post, but I have to explain everything to get the issue I’m experiencing across.

    Side note – I opened a ticket on litespeedtech but was told to post here. https://www.litespeedtech.com/support/forum/threads/issue-with-cache-on-home-page-for-logged-in-users.21347/

    I’m using “User Menus – Nav Menu Visibility” plugin to display “Login” for users that are logged in and “Logout” and “My Account” for users that are not logged in.

    The problem is that after the user logs in, they are redirected to the “Home” page, if they look in the menu “Logout” will appear (as it should), but if they go to another page and return to the main page, the menu shows “Login” again. They have to manually refresh the page for it to be fixed.

    Disabling cache in the plugin or from CPanel does not fix the issue, but adding the following in my .htaccess does:

    # Begin LSCACHE

    Header set Cache-Control “no-cache, no-store, must-revalidate”

    Header set Pragma “no-cache” Header set Expires 0

    # End LSCACHE

    I have seen this issue being reported on other Cache plugins as well, like this one has exactly the same issue I have – https://ww.wp.xz.cn/support/topic/cache-page-is-being-displayed-to-logged-in-users/

    Any help would be greatly apprieciated.

    Thank you.

Viewing 15 replies - 91 through 105 (of 111 total)
  • Thread Starter hagenb

    (@hagenb)

    DAY_IN_SECONDS is a WordPress constant that returns 86400 – https://codex.ww.wp.xz.cn/Easier_Expression_of_Time_Constants

    You said that nothing changes as you disabled YOAST. Did you purge the browser cache as well? Remember, if cache-control is set to public, max-age=86400 that means that your browser caches everything for 1day, this cache-control header as well. In this case LScache doesn’t matter if you purge the LScache, because your browser does not request the server, because of this wrong cache-control setting. Please disable this plugin again, purge LScache AAAAND your browser and check cache-control header again. You also have to remove the changes in .htaccess, before you test it again.

    Thread Starter hagenb

    (@hagenb)

    I tested again, just to make sure (I even uninstalled my browser and installed it again). I deactivated the plugin, removed what was in .htaccess, purge all and it is still the same.

    Thread Starter hagenb

    (@hagenb)

    I think what I’m going to to is get another domain and start fresh, installing a plugin and testing as I go.

    Okay, I give up…. , but remember my last code advice! This should also work and is better as the current one.

    <FilesMatch "\.(php|PHP)$">
    Header set Cache-Control "private,max-age=0,must-revalidate"
    </FilesMatch>
    Thread Starter hagenb

    (@hagenb)

    I have one last question, if you don’t mind before I move on from this. What are the disadvantages of using Header set Cache-Control "private,max-age=0,must-revalidate"? Do I have to worry about security or anything like that?

    So it has nothing to do with security. This last code suggestion has no disadvantage, but the advantage that it preserves the special functions of the LiteSpeed web server.

    Special feature, you remember? https://docs.litespeedtech.com/lscache/devguide/advanced/#understanding-response-status-codes-200-and-304

    • This reply was modified 3 years, 4 months ago by serpentdriver.
    Thread Starter hagenb

    (@hagenb)

    Ok, thank you. I will revisit this at a later stage. If there are any updates, I will post them here. Thank you once again for all your help.

    It will probably end with you having to reinstall WP…

    Thread Starter hagenb

    (@hagenb)

    @serpentdriver

    I ended up getting a new domain and installing WordPress. A clean start. The only plugin I have installed is “User Menus – Nav Menu Visibility” and the issue is still there. So it is either an issue with Litespeed or with that plugin.

    I feel like the only solution is disabling Litespeed cache completely on my site (from the server side) and getting something like WP-Rocket? Any suggestions would be appreciated.

    You will have the same problems with any other cache plugin, especially since the cause of the problem is not the plugin’s caching function. It is the browser cache and not the plugin cache!!! I don’t know if I’ve already asked you this, but are you using a CDN? Did you install the same plugins as in the previous installation?

    Thread Starter hagenb

    (@hagenb)

    I don’t know if I’ve already asked you this, but are you using a CDN?

    No, I tried setting up QUIC.cloud Yesterday but had some issues getting it to work

    Did you install the same plugins as in the previous installation?

    No, I only installed “User Menus – Nav Menu Visibility”, nothing else.

    • This reply was modified 3 years, 4 months ago by hagenb.

    Could you post the link to this new installation?

    Thread Starter hagenb

    (@hagenb)

    https://eltronix.co.za/

    You will see the same in the header cache-controlpublic, max-age=86400.

    Do you know if there is any proxy server in front of your server? If you don’t know it, you should ask your host provider.

Viewing 15 replies - 91 through 105 (of 111 total)

The topic ‘Litespeed causing issue with menu’ is closed to new replies.