Closed JacquesDurand closed 1 year ago
Hello @JacquesDurand I think the documentation is not clear enough. In the cdn
directive you have to set the dynamic
directive because without that Souin only handles predefined keys. Maybe we could set the dynamic to true
by default in the plugins/caddy/configuration.go
file, it could be a quick win.
In your configuration example that would be
# previous
cdn {
dynamic
# Provider not needed, that's souin by default
# provider default
}
Hi @darkweak, thanks for the quick answer ! I just tested it and it does work with the "dynamic" option. Thanks a lot ! If that's okay with you I can try to make a PR asap to set "dynamic" to true by default in the caddy configuration
Hi !
I am currently trying to integrate souin as a caddy module for the api-platform distribution. Integration with
xcaddy build
works fine, and I managed to hit some cache quite easily. I have some issues concerning invalidation through surrogate keys when using the cdn default (souin) provider. It seems that no surrogate keys are stored, hence making purging irrelevant.The workflow I setup is the following:
GET https://localhost/greetings/1
). First call misses cache, subsequent ones hit flawlesslyGET https://localhost/souin-api/souin/
returns a list of cached keys, butGET https://localhost/souin-api/souin/surrogate_keys
returns an empty listPURGE https://localhost/souin-api/souin/
with the headers { "Surrogate-Key": "/greetings, /greetings/1" } ) returns a 204, but since I believe no key was stored in the first place, it does not have a real impact on the cache itselfHere is my current Caddyfile:
I was wondering if I was missing anything configuration-wise, or even if I misunderstood completely the way we're supposed to integrate surrogate keys. Thanks in advance for your help, if I can provide more details I'll be happy to ! PS: I am far from fluent in go, but if there is a PR to make i could also give it a try !