diff --git a/lib/middleware/vhost.js b/lib/middleware/vhost.js
index <HASH>..<HASH> 100644
--- a/lib/middleware/vhost.js
+++ b/lib/middleware/vhost.js
@@ -17,9 +17,9 @@ module.exports = () =>
       if (bucket) {
         ctx.path = `/${bucket}${ctx.path}`;
       }
-    } else if (ctx.hostname !== "localhost" && !net.isIP(ctx.hostname)) {
+    } else if (!net.isIP(ctx.hostname) && ctx.hostname !== "localhost") {
       // otherwise attempt to distinguish virtual host-style requests
-      ctx.path = `/${bucket}${ctx.path}`;
+      ctx.path = `/${ctx.hostname}${ctx.path}`;
     }
 
     return next();
fix(vhost): actually support specifying buckets via hostname