pluginkollektiv / cachify

Smart but efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
https://wordpress.org/plugins/cachify/
GNU General Public License v2.0
101 stars 32 forks source link

Cachify caches output from WordPress with HTTP-Status-Code 500, but shouldnt #266

Closed karlkowald closed 2 years ago

karlkowald commented 2 years ago

We are using the nginx-hdd Version of cachify and triggered a problem. We had a project which produced in frontend a critical error message, which was handled by WordPress with his ""There has been a critical error on this website." output, delivered with a http-status-code 500.

But cachify saved the output and next time, nginx found the saved file and delivered it as expected with http-status-code 200.

So the problem is, that there shouldnt be a cache-file created if the http-status-code is not 200 in my opinion. Perhaps you should add this check vor error-handling before you write the cache.

Thanks a lot

https://github.com/pluginkollektiv/cachify/blob/9ea110bfc39e677793884076b42b3a14f213da77/inc/class-cachify.php#L1395

Zodiac1978 commented 2 years ago

Hi @karlkowald

thanks for the report! We will take a look at it.

Have you solved the problem already? If yes, can you provide a PR?

karlkowald commented 2 years ago

Hi @Zodiac1978 i just solved it and started a pull request for it -> https://github.com/pluginkollektiv/cachify/pull/267

should do what it should and you can overrule it with own statuscodes if you want.