directus / directus

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.

Home Page:https://directus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caching custom api endpoint not working

CherniyIrtish opened this issue · comments

Describe the Bug

Caching doesn't work for custom api endpoints
Based on docs: https://docs.directus.io/self-hosted/config-options.html#cache
I setup needed headers
CACHE_STATUS_HEADER: 'Header-Name'
CACHE_ENABLED: 'true'
CACHE_NAMESPACE: 'system-cache'
It perfectly works for build-in endpoints, for instance getting collections
host/items/collection - works
host/custom-endpoint - 'Header-Name' always has MISS value

To Reproduce

  1. Create custom endpoint
  2. Set needed env variables
    CACHE_STATUS_HEADER: 'Header-Name'
    CACHE_ENABLED: 'true'
    CACHE_NAMESPACE: 'system-cache'
  3. Call custom endpoint

Directus Version

10.11.0

Hosting Strategy

Self-Hosted (Docker Image)

Database

No response