require promise module
completely rewrite proxy logic