Help to purging cache via cache-handler API

1. The problem I’m having:

I’m having trouble accessing the API of cache management provided by the cache-handler plugin. I’ve been attempting to configure a simple Caddyfile that enables the API, but I haven’t had any success. Could someone please provide me with a straightforward example of a Caddyfile that enables the API and guidance on how to make requests (using curl) to perform cache purging? Any assistance would be greatly appreciated. Thank you!

2. Error messages and/or full log output:

Trying “default” paths (from: GitHub - caddyserver/cache-handler: Distributed HTTP caching module for Caddy)

curl localhost:2019/souin-api/souin

I got response: 404

3. Caddy version:

v2.7.6

4. How I installed and ran Caddy:

a. System environment:

WSL (Windows), downloaded binary and after installed caddy-handler with add-package.

caddy list-modules

show

...
  Standard modules: 106

cache
http.handlers.cache

  Non-standard modules: 2

b. Command:

caddy run

c. My complete Caddyfile:

{
	order cache before rewrite
	debug
	log {
		level debug
	}
	cache {
		log_level debug
		api {
			debug
			# basepath /cache
			souin {
				# basepath /souin
			}
		}
		ttl 15s
	}
}

:8081

route / {
	cache
	reverse_proxy localhost:8080
}

5. Links to relevant resources:

I solved it using the public port and the Cache-Control header (even empty)

curl -X GET http://localhost:8081/souin-api/souin -H "Cache-Control: "

now I need to reach the purge function… work in progress

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