Fork me on GitHub

@aaron51 reitit takes route-first approach, where the middleware (defined in router) are only applied if a route is matched. In your example there is only GET /math defined - if that doesn’t match, the wrap-file is not run. Options here are: 1) use the middleware for the default routes, e.g. (wrap-file (ring/create-default-handler) ".") 2) add a wildcard route ["/* (wrap-file (constantly nil) ".")] where the handler always misses


1 is much better, as the wrap-file is only run if none of the actual routes match.


I think that wrap-file always first checks if there is a file available. This mean doing slow IO for ALL calls.


@ikitommi thank you, that helps a lot. I was having a similar issue with ring-cors and this totally explains it