Move setPathsFromMountpath() from middleware/index to middleware/middleware (comments say that's where functions that are unit tested belong)
properly handle servers located behind a proxy where the host name/port are rewritten