tile server: reduce logging, try no-cache for everything

This commit is contained in:
Adam 2022-05-18 19:38:04 +02:00
parent 6d9f303226
commit 610d559f79

View file

@ -18,7 +18,7 @@ import org.http4k.routing.routes
import org.http4k.routing.static import org.http4k.routing.static
internal class WebMapTileServer( internal class WebMapTileServer(
private val appProps: ApplicationProperties = ApplicationProperties() appProps: ApplicationProperties = ApplicationProperties()
) { ) {
private val tilesLoader = ResourceLoader.Directory(appProps.webmapTileDir.absolutePathString()) private val tilesLoader = ResourceLoader.Directory(appProps.webmapTileDir.absolutePathString())
@ -103,15 +103,16 @@ internal class WebMapTileServer(
.header("Cache-Control", "no-cache") .header("Cache-Control", "no-cache")
} }
requestedETag == currentETag -> { requestedETag == currentETag -> {
println("[${request.etagKey}] currentETag == requested, returning 302 $requestedETag") // println("[${request.etagKey}] currentETag == requested, returning 304 $requestedETag")
Response(Status.NOT_MODIFIED) Response(Status.NOT_MODIFIED)
.header("Cache-Control", "no-cache") .header("Cache-Control", "no-cache")
} }
else -> { else -> {
println("[${request.etagKey}] currentETag != requested, executing request and adding currentETag:$currentETag (requested:$requestedETag)") // println("[${request.etagKey}] currentETag != requested, executing request and adding currentETag:$currentETag (requested:$requestedETag)")
response response
.header("ETag", currentETag) .header("ETag", currentETag)
.header("Cache-Control", "public, max-age=1, stale-while-revalidate=60, stale-if-error=300") // .header("Cache-Control", "no-store")
.header("Cache-Control", "no-cache")
} }
} }
} }