• Resolved Erik Bernskiold

    (@erik-bernskiold)


    Hi there,

    We’ve got a custom REST API endpoint that provides application health information. We’d 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 we’d 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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Did you turn off the cache REST in cache setting ?

    Best regards,

    Thread Starter Erik Bernskiold

    (@erik-bernskiold)

    Yes, as I outlined, that’s one of the steps we tried as a last resort. (Not that we should’ve needed to go there anyway)

    Plugin Support qtwrk

    (@qtwrk)

    now that is weird, please enable the debug log

    it should state why/what happen.

    Thread Starter Erik Bernskiold

    (@erik-bernskiold)

    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 )
    
    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    what’s 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,

    Thread Starter Erik Bernskiold

    (@erik-bernskiold)

    Yeah, cPanel + Litespeed.

    GSLNRXNK

    Plugin Support qtwrk

    (@qtwrk)

    please create a ticket by mail to support at litespeedtech.com with reference link to this topic

    we will investigate further.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘REST Endpoint cached despite disallowed’ is closed to new replies.