How can we add an HTTP cache-control header to assets requests?
There is nothing like that yet. What are you looking for?
Just trying to find out if Squidex is configured to set a caching policy for the image assets.
There is no caching policy but etags are provided:
I know this is an old thread, I just wanted to share how I achieved this.
I was a bit surprised that assets don’t include Cache-Control, so I suspected it might be to do with the Caddy configuration I am using. After changing the configuration, cache-control is being sent in the response header and files are being cached in the browser.
This is my CaddyConfig:
{$SITE_ADDRESS}
tls /etc/ssl/certs/.......
reverse_proxy {$SITE_SERVER} {
header_up X-ForwardedProto {scheme}
header_up X-Real-IP {remote}
header_down Cache-Control max-age=3600
}
You can also control the cache duration via query string.
Just add &cache=3600
to your URLs. Then you can distinguish per asset what the best approach is. But some users update the assets regularly, so caching would be bad for them.