Refactor prefix handling

This commit subtly changes the routing behaviour.  Unlike before all prefixes which match
a request will be tried, this is more natural.

This keeps the performance benefits of prefixes yet limits the side effects, specifically
around exception handling, where a catch all is wanted.