Files
2026-10-12 14:25:22 +02:00

23 lines
646 B
TypeScript

import { defineConfig } from '@adonisjs/static'
/**
* Serves the Angular build copied in "public/". The bundles have a hash
* in their name and can be cached forever, index.html must not be cached.
*
* https://docs.adonisjs.com/guides/static-assets
*/
const staticServerConfig = defineConfig({
enabled: true,
etag: true,
lastModified: true,
dotFiles: 'ignore',
headers: (path) => {
if (/(^|[\\/])(main|chunk|styles|polyfills)-[\w-]{8,}\.(js|css)$/.test(path)) {
return { 'Cache-Control': 'public, max-age=31536000, immutable' }
}
return { 'Cache-Control': 'no-cache' }
},
})
export default staticServerConfig