Fix webmanifest

This commit is contained in:
Hubert Van De Walle 2020-10-28 02:58:30 +01:00
parent cd9fdd28e8
commit a37254452b
2 changed files with 12 additions and 2 deletions

View File

@ -3,9 +3,13 @@ package be.simplenotes.app.filters
import org.http4k.core.Filter
import org.http4k.core.HttpHandler
import org.http4k.core.Request
import org.http4k.core.Status.Companion.OK
object ImmutableFilter : Filter {
override fun invoke(next: HttpHandler) = { request: Request ->
next(request).header("Cache-Control", "public, max-age=31536000, immutable")
val res = next(request)
if (res.status == OK)
res.header("Cache-Control", "public, max-age=31536000, immutable")
else res
}
}

View File

@ -32,7 +32,13 @@ class Router(
val basicRoutes =
routes(
"/health" bind GET to healthCheckController::healthCheck,
ImmutableFilter.then(static(Classpath("/static"), "woff2" to ContentType("font/woff2")))
ImmutableFilter.then(
static(
Classpath("/static"),
"woff2" to ContentType("font/woff2"),
"webmanifest" to ContentType("application/manifest+json")
)
)
)
val publicRoutes = routes(