Rack middleware to extract API versions from the path, header, or query