Small update on this one: using a "path_beg" ACL it seems works...
So, I guess there is something wrong potentially outside of cache.c when using path_end, but affecting the cache in some way. I also noticed some suspicious entries in the cache, like hash=0, but I'm not able to qualify when does it happens. Regards, Pierre On 09/01/2018 19:37, Pierre Cheynier wrote: > I'm experimenting the small objects cache feature in 1.8, maybe I'm > doing something obviously wrong, but I don't get what... > > Here is my setup: > > (...) > > cache static_assets > total-max-size 100 > max-age 60 > > (...) > > frontend fe_main # HTTP(S) Service > bind *:80 name http > > acl cached_service-acl hdr_dom(host) -i cached_service.localdomain > use_backend be_cached_service if cached_service > > backend be_cached_service > acl static_cached_paths path_end -i my/resource/path > http-request cache-use static_assets if static_cached_paths > http-response cache-store static_assets > server srv0 127.0.0.1:8000 > > In that case I can request on /my/resource/path and I'll have something > stored in the cache: > > $ $ curl -v -L http://127.0.0.1/my/resource/path -H "Host: > cached_service.localdomain" > (...) > < HTTP/1.1 200 OK > < Content-Type: application/json > < Date: Tue, 09 Jan 2018 18:32:05 GMT > < Content-Length: 14 > < > [ > "tmp" > ] > > $ echo "show cache static_assets" | sudo socat stdio /var/lib/haproxy/stats > 0x7fbfa94df03a: static_assets (shctx:0x7fbfa94df000, available > blocks:102400) > 0x7fbfa94e11ac hash:3952565486 size:190 (1 blocks), refcount:0, expire:54 > > But, if I request something else, it currently override the first cached > asset and will be served then... > > $ curl -v -L http://127.0.0.1/my/other/resource/path -H "Host: > cached_service.localdomain" > (...) > > < HTTP/1.1 200 OK > < Content-Type: application/json > < X-Consul-Index: 77 > < X-Consul-Knownleader: true > < X-Consul-Lastcontact: 0 > < Date: Tue, 09 Jan 2018 18:33:30 GMT > < Content-Length: 547 > < > { "something_more_verbose(...)" } > > $ echo "show cache" | sudo socat stdio /var/lib/haproxy/stats > 0x7f4c5ea5a03a: static_assets (shctx:0x7f4c5ea5a000, available > blocks:102400) > 0x7f4c5ea5a4cc hash:3952565486 size:797 (1 blocks), refcount:0, expire:55 > > The entry has been flushed and replaced by the new one, independently > from the expiration state. > > In that case it's consul that answer, so it explains these X-Consul > headers for the 2nd response. > > Does it ring a bell to someone ? > > Thanks, > > Pierre > >
signature.asc
Description: OpenPGP digital signature

