fun Routing.preCompressed(vararg types: CompressedFileType = CompressedFileType.values(), configure: Routing.() -> Unit)

Support pre-compressed files and resources

For example, by using preCompressed() (or preCompressed(CompressedFileType.BROTLI)), the local file /foo/ can be found @ http..../foo/bar.js

Appropriate headers will be set and compression will be suppressed if pre-compressed file is found


  • The order in types is important. It will determine the priority of serving one versus serving another

  • This can't be disabled in a child route if it was enabled in the root route