• Resolved michaelhogan

    (@michaelhogan)


    Hello,

    We are using Force Login on our site so that user’s are required to login when visiting. We also use a caching plugin that caches all of our pages server-side to increase load times. Does Force Login automatically deny caching of any kind when enabled? User caching, server-side caching via another plugin, etc. When using our caching plugin, the “pre-load cache” option only works when Force Login is disabled.

    Any info would be great.
    Thanks,
    Mike

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi– thanks for using Force Login!

    Yes, Force Login does add no-cache headers to prevent browser caching at the redirect to login:
    https://github.com/kevinvess/wp-force-login/blob/2e6d0fd1d35d665852903500da86d86216aced81/wp-force-login.php#L44

    This was implemented a few years ago at the suggestion of another user:
    https://github.com/kevinvess/wp-force-login/pull/42

    I hope this was helpful, thanks!

    • This reply was modified 4 years, 2 months ago by Kevin Vess. Reason: Clarified the addition of no-cache headers to prevent browser caching
    Thread Starter michaelhogan

    (@michaelhogan)

    Hi Kevin,

    Thank you for the reply! Could I use an older version of Force Login to bypass this feature? We have a a caching plugin that we want to use on our site while also using Force Login. I’m not sure if I could pull an old version and use that or if it wouldn’t work with modern WP.

    Thanks,
    Mike

    Plugin Author Kevin Vess

    (@kevinvess)

    The no-cache headers were added to Force Login in version 5.3.

    You could use an earlier version to avoid that change, but I don’t recommend it. While earlier versions should work fine in the current WordPress version, you would lose out on some of the other improvements that were (and will be) made.

    If you’re not worried about missing out on future updates to the plugin, I would at least copy/alter the current Force Login plugin and rename it to get the latest build minus the no-cache headers.

    Thanks!

    Plugin Author Kevin Vess

    (@kevinvess)

    To explain further, the no-cache headers were added to Force Login to ensure only the URL redirect wasn’t cached by the browser. After the user logs in and views a page –?that page should still be able to be cached by the logged-in user.

    Your other caching plugin’s “pre-load cache” option maybe isn’t working with Force Login, but you should be able to set up a browser cache for pages after logging in.

    Thread Starter michaelhogan

    (@michaelhogan)

    Thank you again for the info! In this case, browser cache still definitely works, but we wanted to get all of our pages cached server-side so that when first visiting a page (we have a lottt of pages), it will be able to load quicker instead of having to cache it first in the browser. Just for my own testing purposes with Force Login, if I were delete the no cache function in your code, would that alone stop the plugin from calling that function and everything that would be denying the URL redirect caching that you’re talking about?

    Plugin Author Kevin Vess

    (@kevinvess)

    If you delete the nocache_headers() function in Force Login, that would stop the plugin from calling that function.

    Keep in mind, that function should only affect browser caching (according to the WordPress Codex). Either way, that shouldn’t affect your server-side caching.

    Let me know if you find a solution to this.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Does Force Login automatically add no-cache headers to prevent caching?’ is closed to new replies.