Hi!
1. The problem I’m having:
I’m using Caddy to host SPA. Problem is: browsers are caching my index.html file. I’ve disabled caching through the Header directive and a filter on the root url + index.html
But users are accessing my SPA from various urls such as https:/domain.tld/some/thing and won’t always access the route url (https:/domain.tld/).
How can I configure a header based on the file returned (index.html) and not the url accessed ?
3. Caddy version: 2.7.6
4. How I installed and ran Caddy: docker official image
d. My complete Caddy config:
{$SERVER_NAME}
log
@spa expression `!path(
'/', '/static/*', '/docs*', '/api*', '/login', '/logout', '/external*', '/graphql*', '/bundles*', '/contexts*', '/_profiler*', '/_wdt*',
'*.json*', '*.html', '*.csv', '*.yml', '*.yaml', '*.xml'
)
|| path('/favicon.ico', '/manifest.json', '/robots.txt', '/sitemap*')`
route {
@index {
path /
path /index.html
}
header @index {
Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Pragma "no-cache"
Expires 0
}
root @spa /srv/app/front
root * /srv/app/public
try_files {path} /index.html
php_fastcgi unix//var/run/php/php-fpm.sock
encode zstd gzip
file_server
}