refactor cookie setting on dmm_api to a before filter