You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I'm trying to understand how to use surrogate keys and can't seem to get it to work by merely following the spec.
My use-case is that I need to associate a group of cached files with a "project ID" so I can purge all files for the project when it is modified. I'm using Caddy and Otter.
Here's my Caddy config (using github.com/darkweak/souin/plugins/[email protected])
{
cache {
ttl 300s
max_cacheable_body_bytes 1000000
otter
api {
souin
}
# This may be required to enable surrogate-keys? https://github.com/darkweak/souin/issues/306#issuecomment-1429744951
cdn {
dynamic
provider souin
}
default_cache_control public
}
}
localhost {
route {
cache reverse_proxy web:3000
}
}
When I want to set a surrogate-key, I include the header in the response in my application code (web:3000):
$ curl -ik -H "Host: picouser-www.localhost" https://localhost
HTTP/2 200
alt-svc: h3=":443"; ma=2592000
cache-control: public
cache-status: Souin; fwd=uri-miss; stored; key=GET-https-picouser-www.localhost-/
content-security-policy: script-src 'self'
content-type: text/html
date: Tue, 22 Oct 2024 02:16:29 GMT
etag: 5fddc78468241bf0dc7e721867874288
last-modified: Mon, 21 Oct 2024 20:21:37 GMT
server: Caddy
strict-transport-security: max-age=31536000; preload
surrogate-key: picouser-www <------ Project ID surrogate key is set here
x-frame-options: DENY
content-length: 2051
Hello! I'm trying to understand how to use surrogate keys and can't seem to get it to work by merely following the spec.
My use-case is that I need to associate a group of cached files with a "project ID" so I can purge all files for the project when it is modified. I'm using Caddy and Otter.
Here's my Caddy config (using
github.com/darkweak/souin/plugins/[email protected]
)When I want to set a surrogate-key, I include the header in the response in my application code (
web:3000
):But the surrogate key is never saved:
Likewise, purging via the surrogate key I set also does not clear this cache entry.
I searched through the code and is seems like what I'm doing should work, but I may be missing a config value or something:
souin/pkg/surrogate/providers/common.go
Line 238 in 2968d51
Am I using the feature incorrectly? Or could there be a bug? Happy to provide further info!
The text was updated successfully, but these errors were encountered: