REST Endpoint cached despite disallowed




Wordpress LScache Plugin: REST Endpoint cached despite disallowed

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi there, Weve got a custom REST API endpoint that provides application health information. Wed like to ensure that it is never cached. To do this we have: 1. Made sure the endpoint callback calls do_action( litespeed_control_set_nocache, nocache due to application health ) . 2. Told the API endpoint to respond with no-cache headers. Despite this, the endpoint remains served with a x-litespeed-cache hit header. Next, we tried manually adding the endpoint URL under Cache > Excludes > Do Not Cache URIs. This is the scenario that wed like to get away from doing with the action call, but just for debugging purposes. Still the same result. The response is served as a cache hit. Finally, we disabled the option of caching the REST API completely in Cache > Cache. We still get a cache hit. Every time we purge the cache, the endpoint refreshes successfully. But on subsequent hits, they are always cached. Regardless of any rules. This is a multisite install, but changing network enable cache has no effect. Disabling the cache completely disables the cache hits as expected. The server is a Litespeed server. This topic was modified 11 months, 1 week ago by Erik Bernskiold. Hi, Did you turn off the cache REST in cache setting ? Best regards, Yes, as I outlined, thats one of the steps we tried as a last resort. (Not that we shouldve needed to go there anyway) now that is weird, please enable the debug log it should state why/what happen. If I turn off caching the REST API, nothing is logged. Cache hit header is still set on response, which is also cached. If I turn on caching the REST API, the following is logged (cache hit header is still set on response, which is also cached): 12/18/21 18:01:04.824 [XXXXXXXX 1 1v6] Query String: 12/18/21 18:01:04.985 [XXXXXXXX 1 1v6] [Vary] Guest mode 12/18/21 18:01:04.989 [XXXXXXXX 1 1v6] [Optm] init 12/18/21 18:01:05.054 [XXXXXXXX 1 1v6] [Ctrl] X Cache_control init on 12/18/21 18:01:05.063 [XXXXXXXX 1 1v6] [Vary] Rest API init disabled vary change 12/18/21 18:01:05.084 [XXXXXXXX 1 1v6] [Ctrl] X Cache_control -> no Cache ( nocache due to application health ) Hi, whats your server env ? cPanel or something ? and also please provide the report number , you can get it in toolbox -> report -> click send to LiteSpeed Best regards, Yeah, cPanel + Litespeed. GSLNRXNK please create a ticket by mail to support at litespeedtech.com with reference link to this topic we will investigate further.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference