BoldGrid / w3-total-cache

GNU General Public License v2.0
152 stars 84 forks source link

Add ability to prevent caching on 403 responses added by security plugins #350

Open mavas84 opened 3 years ago

mavas84 commented 3 years ago

It seems that Wordfence 403 response is cached since Wordfence and other plugins of this type don't care to define the DONOTCACHEPAGE constant when it fires 403.

w3tc doesn't care if it's 403 or not. It's generated by wp it's cached. w3tc cant know if some plugin decided to return something that should not be cached Reference topic: https://wordpress.org/support/topic/prevent-white-pages-403-forbidden-from-being-cached/

iSevenDays commented 3 years ago

I have the same issue - if some visitor was blocked (403 error) and W3 total cache caches this page, then the next visitor also gets 403 error. This can make the whole website inaccessible if 403 error is triggered for index page, and this is exactly what I got.

I indeed think this is W3 total cache issue because once I cleared the cache, the issue disappeared.

mavas84 commented 3 years ago

Hello @iSevenDays

Thank you for the information. Can you please confirm if the plugin you are using for this is Wordfence? Thanks!

karks88 commented 3 years ago

I'm seeing a similar issue with a site running iThemes Security Pro and W3 Total Cache. In fact, I switched from Wordfence because I had been having the same problem with that plugin as well. The 403 page gets cached and unfortunately stays that way until I clear it out.