bluehost / endurance-page-cache

Other
24 stars 11 forks source link

Plugin should not break XML/JSON #5

Closed stodorovic closed 7 years ago

stodorovic commented 7 years ago

Example:

$ curl http://www.example.tld/wp-json/
{"name":"Test","description":"Just another WordPress site",............................,
"_links":{"help":[{"href":"http:\/\/v2.wp-api.org\/"}]}}
<!--Generated by Endurance Page Cache-->

So, a solution could be to check REST_REQUEST and don't cache REST API. Alternative solution is to use DONOTCACHEPAGE and don't cache page if it's defined (standard in almost all cache plugins). I think that isn't too complicated to add it into the code.

MikeHansenMe commented 7 years ago

Thanks for reporting the issue.

Just added https://github.com/bluehost/endurance-page-cache/commit/31a3d242ca702c92fe1b3949f04f63a56daf15f2

https://github.com/bluehost/endurance-page-cache/commit/7750c25df07caa9101046bf9876351e511a38bf4

https://github.com/bluehost/endurance-page-cache/commit/cb4f850f19a0f2f03ac7a06092697daea560be9e

Those should prevent it from caching the wp-json api and xml.

Please let me know if that works for you.

MikeHansenMe commented 7 years ago

Closing per the commits above.