Refactor router and virtual host to share similar processing
Refactor router and virtual host to share similar processing