Wildcard selection for headers (caching?)

I’m trying to set a header cache exclude for my wp-admin pages. While I can login OK (caching is disabled for the login page), pages within the dashboard won’t update (i.e. are still cached). I am wondering if I should be using a wildcard, like wp-* to match any URL with wp-login or wp-admin at the start, or maybe even a “starts_with wp-” (but unsure if that variable is only for redirects, rather than headers).

Currently:

header /wp-login/ {
Cache-Control no-cache
}
header /wp-admin/ {
Cache-Control no-cache
}

Wondering if it should be along the lines of:

header /wp-login* {
Cache-Control no-cache
}
header /wp-admin* {
Cache-Control no-cache
}

But just not sure of the specifics (maybe it should be /wp-admin.*?)

The path you set for the directive is a base path - you can just use header /wp- Cache-Control no-cache and it’ll handle any request with a path that begins with /wp- (equivalent to ^/wp-.*$ regex, I guess)

Thank you so much!

Hi @willbox

You also have wp-content where cache is very helpful! It may be best to disable cache to wp-login and wp-admin only, but that depends on your use case

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.