mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 15:34:17 +01:00
handle http cache for static assets, except index.html and favicon.ico
This commit is contained in:
parent
aa969fd8bd
commit
f00f565519
2 changed files with 27 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
package org.gotson.komga.infrastructure.web
|
||||
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.http.CacheControl
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||
|
||||
@Configuration
|
||||
class StaticResourceConfiguration : WebMvcConfigurer {
|
||||
override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
|
||||
registry//.setOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
.addResourceHandler(
|
||||
"/index.html",
|
||||
"/favicon.ico"
|
||||
)
|
||||
.addResourceLocations(
|
||||
"classpath:public/index.html",
|
||||
"classpath:public/favicon.ico"
|
||||
)
|
||||
.setCacheControl(CacheControl.noStore())
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,11 @@ spring:
|
|||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
resources:
|
||||
cache:
|
||||
cachecontrol:
|
||||
cache-public: true
|
||||
max-age: 365d
|
||||
|
||||
management:
|
||||
endpoints.web.exposure.include: "*"
|
||||
|
|
|
|||
Loading…
Reference in a new issue