caddyserver/cache-handler

Last-Modified header and cache skip

fliespl opened this issue · 0 comments

    @cacheable_sitemap {
       path_regexp "^/([a-z0-9-]+-sitemap([0-9]+)?|sitemap_index)\.xml"
    }

    header @cacheable_sitemap {
        -Last-Modified
        +X-Sitemap 1
    }

    cache @cacheable_sitemap {
        cache_name sitemap
        key {
            disable_method
            disable_query
        }
        mode bypass
        ttl 300s
    }

I would like to use such rules to cache sitemap files.

Unfortunately, no matter what I do Last-modified header is still returned to the client and subsequent requests have If-Modified-Since set making souin to request backend due to: detail=REQUEST-REVALIDATION. For test purposes I have added X-Sitemap one and it gets appended.

I have also tried request_header matcher to remove "if-modified-since" but I guess it executes after cache part.

Any ideas? :)