Refactor the reverse proxy