Hi there,
I found that v8.3.1 have set the cache control for download endpoint but not enable cache control on assets endpoint, Can we do that for assets endpoint?
@directus/api thoughts?
@everyx - Are you using a proxy? As you mention the download endpoint which is for proxy's only.
@bjgajjar What is the proxy meaning, or how do I know if I'm using a proxy? the origin file down path return by api is used download endpoint to me.
{
"data": {
"api": {
"version": "8.3.1",
"requires2FA": false,
"database": "mysql",
"project_logo": {
"url": "\/downloads\/xxxxxxxx\/7b7b0446-6fe0-4efc-92ab-38207234c216.svg",
"full_url": "https:\/\/api.fengsi.io\/downloads\/xxxxxxxx\/7b7b0446-6fe0-4efc-92ab-38207234c216.svg"
},
"project_color": "#00662F",
"project_foreground": {
"url": "\/downloads\/xxxxxxxx\/7b7b0446-6fe0-4efc-92ab-38207234c216.svg",
"full_url": "https:\/\/api.fengsi.io\/downloads\/xxxxxxxx\/7b7b0446-6fe0-4efc-92ab-38207234c216.svg"
},
"project_background": null,
"default_locale": "zh-CN",
"telemetry": true,
"project_name": "xxxxxx",
"project_public_note": ""
},
"server": {
"max_upload_size": 67108864,
"general": {
"php_version": "7.4.1",
"php_api": "fpm-fcgi"
}
}
}
}
@everyx - Currently the proxy URL contains the cache-control variable. You are getting the downloads endpoint as you enabled storage.proxy_downloads; otherwise, the file origin URL will have a uploads URL.
As per my knowledge, we don't have any feature to add cache-control in directus other endpoint for now except /downloads.
@rijkvanzanten - Let me know if we are supposed to add this feature.
Lets add it 馃憤 having the thumbnails cached in the browser makes perfect sense to me
downloads endpoint contains cache-control and set a max-age as proxy_downloads_cache_ttl from directus_settings table. Right now, we dont have any variable named proxy_downloads_cache_ttl in settings table.
Let's add one variable named thumb_cache_ttl which will use for thumbnails as well as downloads
@dwene posted some thoughts on how to configure this in the duplicate issue mentioned above:
Perhaps either:
I personally prefer number 1.
I think we should implement option 3 to provide good defaults, and then consider adding 1. as a parameter for more fine-grained control 馃檪
@bjgajjar this could be a good low-hanging fruit feature to implement a little earlier. Doesn't sound too difficult to add, but gives a huge performance boost for websites relying on the asset endpoint.
+1, sounds like a good idea!
Did the thing!
The ASSETS_CACHE_CONTROL variable is not taken into account in .env:

Here's the asset url: https://foobar.com/assets/54a1d57a-a73a-4114-8be2-20d5050fdabf?width=1920&height=1080
And here's the response header: cache-control: public, max-age=1800000
Most helpful comment
@dwene posted some thoughts on how to configure this in the duplicate issue mentioned above:
Perhaps either:
I personally prefer number 1.
I think we should implement option 3 to provide good defaults, and then consider adding 1. as a parameter for more fine-grained control 馃檪
@bjgajjar this could be a good low-hanging fruit feature to implement a little earlier. Doesn't sound too difficult to add, but gives a huge performance boost for websites relying on the asset endpoint.