I'm using php to output an image using readfile function. I've set the headers for this php file as below:
$expires = 60*60*7;
header('Pragma: public');
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + $expires));
header('Content-Type: image/jpeg');
header("Cache-Control: maxage=".$expires);
Both expire and Cache-Control headers are set, but each time i load the url, image gets downloaded. Is there any other header rule needed to enable caching?