1
API Cache doesn't respect custom headers
Source: directus/directus#24885 · opened by @piotr-cz
Describe the Bug
Directus API caching mechanism (particularly the [getCacheKey]( function) doesn't respect custom headers.
In effect when cache is enabled API returns exact same response to two requests with varying request header.
Possible solution: Add new Configuration Option to specify custom headers which will respected when creating cache key.
Related PR:
To Reproduce
1. Enable cache (CACHE_ENABLED=true)
1. Create [Custom API hook]( extension with following content:
1. Send valid request (responds with Status: 200 OK)
1. Send invalid request (should respond with Status: 503 Invalid token)
Errors Shown
No errors shown
What version of Directus are you using?
9.21.2
What version of Node.js are you using?
16.18.0
What database are you using?
MySQL
What browser are you using?
Chrome
How are you deploying Directus?
locally
Directus API caching mechanism (particularly the [getCacheKey]( function) doesn't respect custom headers.
In effect when cache is enabled API returns exact same response to two requests with varying request header.
Possible solution: Add new Configuration Option to specify custom headers which will respected when creating cache key.
Related PR:
To Reproduce
1. Enable cache (CACHE_ENABLED=true)
1. Create [Custom API hook]( extension with following content:
1. Send valid request (responds with Status: 200 OK)
1. Send invalid request (should respond with Status: 503 Invalid token)
Errors Shown
No errors shown
What version of Directus are you using?
9.21.2
What version of Node.js are you using?
16.18.0
What database are you using?
MySQL
What browser are you using?
Chrome
How are you deploying Directus?
locally
No pledges yet. Be the first to back this.
Comments
Similar requests
Allow extensions to access the configured directus cache
27 votes · 0 comments
Clear cache CLI command
21 votes · 0 comments
`CACHE_ENABLED` should not affect `CACHE_CONTROL_S_MAXAGE`
1 vote · 0 comments
Cache only for specific items
2 votes · 0 comments
API Testing UI (Swagger-like) with Role-Based Simulation
5 votes · 0 comments
No comments yet.