Update Cache_Enabler::handle_cache() to only cache a page if the HTTP status code is 200. (I did not find a requirement to check for any other successful status codes.) Previously any HTTP status codes could potentially be cached, such as 4xx and 5xx in certain edge cases. Previously only 404 statuses were being checked with is_404() but in some cases it does not always return true, resulting in the error page being cached. If using the advanced cache (default) the error page was cached an undesired 200 status would then be delivered with the cached page afterwards. (Similar issue that occurred in the past with trailing slashes.) This will either partially or completely fix the issue when a page request with special characters is cached (#93).
Update Cache_Enabler::_bypass_cache() to no longer check is_404() because we are checking all HTTP status codes now. Also update this method to no longer check the trailing slash because a 301 redirect can no longer be cached.
Remove Cache_Enabler::_bypass_cache_for_trailing_slash() and instead use the permalink_structure_changed action hook to clear the complete cache when the permalink structure changes. This is required since updating Cache_Enabler::_bypass_cache() to not check the trailing slash. Further, it is a cleaner way to approach this since changing the permalink structure is not done often. This is required now because if a cached page existed and the trailing slash in the permalink structure was changed the redirect would not be honored because a 200 status code is being sent.
Update
Cache_Enabler::handle_cache()
to only cache a page if the HTTP status code is200
. (I did not find a requirement to check for any other successful status codes.) Previously any HTTP status codes could potentially be cached, such as4xx
and5xx
in certain edge cases. Previously only404
statuses were being checked withis_404()
but in some cases it does not always return true, resulting in the error page being cached. If using the advanced cache (default) the error page was cached an undesired200
status would then be delivered with the cached page afterwards. (Similar issue that occurred in the past with trailing slashes.) This will either partially or completely fix the issue when a page request with special characters is cached (#93).Update
Cache_Enabler::_bypass_cache()
to no longer checkis_404()
because we are checking all HTTP status codes now. Also update this method to no longer check the trailing slash because a301
redirect can no longer be cached.Remove
Cache_Enabler::_bypass_cache_for_trailing_slash()
and instead use thepermalink_structure_changed
action hook to clear the complete cache when the permalink structure changes. This is required since updatingCache_Enabler::_bypass_cache()
to not check the trailing slash. Further, it is a cleaner way to approach this since changing the permalink structure is not done often. This is required now because if a cached page existed and the trailing slash in the permalink structure was changed the redirect would not be honored because a200
status code is being sent.