wai-extra-0.4.4: Provides some basic WAI handlers and middleware.

Network.Wai.Middleware.Rewrite

Synopsis

Documentation

rewrite :: ([Text] -> RequestHeaders -> IO [Text]) -> MiddlewareSource

rewrite based on your own conversion rules Example usage: rewrite (autoHtmlRewrite static)

autoHtmlRewrite :: String -> [Text] -> RequestHeaders -> IO [Text]Source

example rewriter We don't recommend normally checking the file system on every request - this is just an example. Implements 2 rules for static html re-writes 1) for a directory foo, check for fooindex.html 2) for a non-directory bar, check for bar.html Do the rewrite only if the html file exists.