HTTP cache recommendation for Traefik 2.x on Docker?

I'm looking to speed up access to HTTP resources and have been exploring cache options. I've come across two possibilities:

  • Simple Cache
    Seemed promising, but it doesn't appear to be actively maintained, and some users have reported it not working.

  • Souin
    Seems more full-featured but more complicated to set up.

Does anyone have any experience with either of those plugins or any other recommendations?

Thanks for any info or insights!

Is anyone using Souin with Traefik v3?

Maybe ask on the Reddit Traefik forum, sometimes it seems there is more traffic there.

Hello,

Why do you think it's more complicated to setup @shot ? I do like to read some user feedback about DX/UX. We could see together if it's possible to make complicated parts simpler.

Hey @darkweak, thanks for the reply!

I was unsuccessful setting it up as a container (as opposed to using it as a plugin). The main problem was TLS related as described in this post. I think the main issue was the fact that I'm running a root CA on my dev machine (created with mkcert), so acme.json really doesn't apply in that context, and I couldn't figure out how to make it work. Maybe I overlooked something obvious.

Anyway, since then, I gave plugin mode another go (no pun intended) and was SUCCESSFUL! I've now got it working on my dev machine, although lots of tweaks and refinements are still needed. It's been quite a learning experience, because I'm using several middlewares which add, remove, and modify headers; and there was a LOT of trial and error needed to figure out where in the middleware "chain" Souin should go.

At least I'm making progress now, so that's a good thing. Thanks for taking the time to respond to my post and also for creating Souin! :slightly_smiling_face:

Hello, I've recently started using Souin with Traefik V3. From what I can see in the logs, there don't appear to be any errors when loading the plugin, but I'm unsure if the cache is actually functioning. Could you help me understand this better?

my traefik.yaml plugin config

experimental:
  plugins:
    souin:
      moduleName: "github.com/darkweak/souin"
      version: "v1.7.2"

my dynamic config for middlewares

http:
  middlewares:
    http-cache:
      plugin:
        souin:
          api:
            souin: {}
          default_cache:
            ttl: 5s
            redis:
              url: redis://:password@redis:6379
            allowed_http_verbs:
              - GET
              - HEAD
              - POST
            default_cache_control: no-store
          log_level: debug

Traefik logs

2024-09-21T17:54:53+05:30 INF Loading plugins... plugins=["souin"]
2024-09-21T17:54:55+05:30 INF Plugins loaded. plugins=["souin"]
2024-09-21T17:54:55+05:30 INF Starting provider aggregator aggregator.ProviderAggregator
2024-09-21T17:54:55+05:30 INF Starting provider *file.Provider
2024-09-21T17:54:55+05:30 INF Starting provider *traefik.Provider
2024-09-21T17:54:55+05:30 INF Starting provider *docker.Provider
2024-09-21T17:54:55+05:30 INF Starting provider *acme.ChallengeTLSALPN
2024-09-21T17:54:55+05:30 INF Starting provider *acme.Provider
2024-09-21T17:54:55+05:30 INF Testing certificate renew... acmeCA=https://acme-v02.api.letsencrypt.org/directory providerName=cloudflare.acme

Cache middleware setup in service (homer dashboard)

labels:
      - "traefik.enable=true"
# middlewares
      - "traefik.http.middlewares.homer-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.homer-https-redirect.redirectscheme.permanent=true"

      - "traefik.http.routers.homer.entrypoints=http"
      - "traefik.http.routers.homer.rule=Host(`${HOMER_URL}`)"
      - "traefik.http.routers.homer.middlewares=homer-https-redirect"
# entrypoints
      - "traefik.http.routers.homer-secure.entrypoints=https"
      - "traefik.http.routers.homer-secure.rule=Host(`${HOMER_URL}`)"
      - "traefik.http.routers.homer-secure.tls=true"
      - "traefik.http.routers.homer-secure.service=homer"
      - "traefik.http.services.homer.loadbalancer.server.port=${CUSTOMIZED_PORT}"
      - "traefik.docker.network=proxy"
# cache setup
      - traefik.http.routers.homer.middlewares=http-cache
      - traefik.http.middlewares.http-cache.plugin.souin.api.souin
      - traefik.http.middlewares.http-cache.plugin.souin.default_cache.ttl=10s
      - traefik.http.middlewares.http-cache.plugin.souin.default_cache.allowed_http_verbs=GET,HEAD,POST
      - traefik.http.middlewares.http-cache.plugin.souin.log_level=debug

There are no ways I could find any logs related to souin