moved proxy to middleware