I’m looking for a way to gzip my XML responses and only them. I didn’t find any materials how to do this in Zend Framework. I have a response method in my abstract controller, like this:
public function xmlResponse(SimpleXMLElement $xml, $contentType = null){
$this->_helper->layout->disableLayout();
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
$this->_response->setHeader('Content-Type', ($contentType) ? $contentType : 'text/xml');
$this->_response->setBody($xml->asXML());
} // xmlResponse
and I want to add gzip compression in here.
Thanks for help!
Is this what you are looking for?:
EDIT: You could try this, I have not tested it though:
EDIT: Or you could just add this line to your .htaccess file
I hope this helps
Kind regards,
Garry