Get the Headermanager via singleton,set the last modified date and send the header (before you flush any site-output).
using('cube.core.http','headermanager');
$headerManager = & singleton_Singleton::getInstance('http_headermanager');
$headerManager->setLastModifiedDate($lastDate);
$headerManager->sendHeader();
using('cube.core.http','headermanager');
$headerManager = & singleton_Singleton::getInstance('http_headermanager');
$headerManager->setAlwaysReload(true);
$headerManager->sendHeader();
Add the taglib to the head part of your cube stylesheet.
<cube:addTagLib namespace="cube.apps.ui" file="header" prefix="hedr"/> <hedr:header/>
$headerManager->setShowTagLib(true);