Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature Request: Extend Caching of Nonces for Logged-In Users where nonce_life filter used #884

Open
KTS915 opened this issue Apr 13, 2017 · 1 comment

Comments

@KTS915
Copy link

KTS915 commented Apr 13, 2017

I understand that Comet Cache sensibly limits the lifetime of a cache that includes a nonce for the following reason (explained in #793):

Ensure the cache file that contains a Nonce value does not stay around for longer than the minimum lifetime of a WordPress Nonce, which is 12 hours. If it stays around for longer than 12 hours, then the user who loads the cache file will find themselves clicking buttons and submitting forms that result in an error due to the expired Nonce value.

I have recently come across a plugin called Nonce Extender. A quick look in its code showed me that it uses a WP filter called nonce_life that I had not heard of before, but which allows a user to extend the life of a nonce.

So I am wondering whether it would be possible for Comet Cache to detect whether such a filter has been used on a site, and then to adjust the lifetime of the cache to reflect the adjusted lifetime of the nonce. (Just to be clear, I am suggesting this only for nonces of logged-in users.)

@raamdev
Copy link
Contributor

raamdev commented Apr 13, 2017

Here's the relevant nonce_life line in WordPress: https://github.com/WordPress/WordPress/blob/4.7.3/wp-includes/pluggable.php#L1822

The only problem I see with dynamically adjusting the cache expiration time is that would mean adjusting the cache expiration time for all of the cache (including anonymous visitors). It's currently not possible to dynamically specify a cache expiration time (although we do have a related GitHub issue open here: #170).

@jaswrks Any thoughts on this feature request?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants