Skip to content

Unable to purge root path ("/") cache entry without clearing entire cache #48

@antoniy-mihaylov

Description

@antoniy-mihaylov

We are unable to purge the cache entry for the root path ("/") without clearing the entire cache using a wildcard.

Environment:

  • nginx version: 1.27.4
  • ngx_cache_purge version: 2.5.4

Setup:

  • nginx with ngx_cache_purge module
  • Cache key format: $scheme$host$request_uri
  • Purge endpoint: location ~ ^/ops/purge(/.*)$ { proxy_cache_purge cache_zone $scheme$host$1; }
  • Actual cache key for root: httpmyapp.example.com/ (scheme + host + /)

Problem:

When attempting to purge the root path cache entry:

  1. Exact match purge (/ops/purge/) → Returns HTTP 412

    • Expected cache key: httpmyapp.example.com/
    • Result: Not purged (HTTP 412 - NGX_DECLINED)
  2. Wildcard purge (/ops/purge/*) → Returns HTTP 200

    • Problem: Purges ALL cache entries, not just the root path
    • This is unacceptable as it clears the entire cache

Questions:

  • Does exact key purging work for root path entries?
  • Is there something special about purging cache keys that end with just "/" (the root path)?
  • Should the cache key httpmyapp.example.com/ be purgeable via exact match?

We would appreciate any guidance on whether this is expected behavior or if there is a configuration/approach we are missing to purge the root path cache entry specifically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions