Add cookie re-mapping to proxy middleware.
Refactor server module to expose middlewares.