hey guys, when updating to ktor 3.0.0-rc-1 I have...
# ktor
h
hey guys, when updating to ktor 3.0.0-rc-1 I have a global caching header and few other per route
Copy code
Exception in thread "main" io.ktor.server.application.DuplicatePluginException: Please make sure that you use unique name for the plugin and don't install it twice. Plugin `Caching Headers` is already installed to the pipeline
since there’s no docs for 3.0.0-rc-1, here’s the link to the beta2 https://ktor.io/docs/3.0.0-beta-2/server-caching-headers.html#configure-route which worked fine
Copy code
fun Application.caching() {
    install(CachingHeaders)
}

fun Routing.cachedRoute(
    maxAgeSeconds: Int
) {
    install(CachingHeaders) {
        options { _, _ -> CachingOptions(CacheControl.MaxAge(maxAgeSeconds = maxAgeSeconds)) }
    }
}
i have these simple helper functions, pretty self explanatory
if i remove the
Routing.cachedRoute
from my routes, it’s okay, it works
a
I get the following exception when calling them for the application and routing respectively:
Copy code
Exception in thread "main" io.ktor.server.application.DuplicatePluginException: Installing RouteScopedPlugin to application and route is not supported. Consider moving application level install to routing root.
thank you color 1
Here is the code:
Copy code
fun main() {
    embeddedServer(Netty, port = 8081, host = "127.0.0.1") {
        caching()
        routing {
           cachedRoute(100)
        }
    }.start(wait = true)
}