usually the problem occures when you touch the response before setting the header. I mean you got to do this settings before ANY change in the response or the API will ignore it.