Using setExpires on returnJson From a custom plugin controller, I am returning data as json using $this-&gt;returnJson($data). I need to be able to set the Cache-Control headers for my forward cache proxy to handle caching correctly. 

I tried using HeaderHelper::setExpires(300), but JsonHelper::sendJsonHeaders(), which is called by $this-&gt;returnJson() from the controller, overrides setExpires by calling HeaderHelper::setNoCache(). 

Does anyone have any ideas for working around this or configuring returnJson? I can do the following in my controller (or create a helper of my own):

HeaderHelper::setExpires(300);
HeaderHelper::setContentTypeByExtension('json');
ob_start();
echo JsonHelper::encode($return);
craft()-&gt;end();


but I'd rather use the super convenient returnJson function.
If you're running Craft CMS 2.6.2783, you can pass in an 'expires' key to the optional $options 2nd parameter of returnJson with the value set to the time in seconds that will be passed to the cache control expiration headers.  If you ignore it, it will have the current behavior of not caching at all.