Alex-Grim Posted November 23, 2009 Share Posted November 23, 2009 Ok, this is driving me insane. I have no problem on the server level, but when trying to set cache control with PHP it simply will not work for me. I WANT cache, and LOTS of it! $expires = 60*60*24*365; $size = filesize("{$client_directory}/{$_GET['did']}"); header("Content-Length: ".$size,true); header("Cache-Control: max-age={$expires}, public, no-transform",true); header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT',true); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()-$expires) . ' GMT',true); header("Content-type: audio/example"); header("Content-Disposition: attachment; filename=\"{$_GET['did']}\""); readfile("{$client_directory}/{$_GET['did']}"); ALL of the other headers are fine, but the cache control will NOT set??? I've tried so many different ways, and none of them are working. Here are the output headers: Status=OK - 200 Date=Mon, 23 Nov 2009 08:15:19 GMT Server=Apache/2.2.8 (Fedora) Content-Length=4400274 Content-Disposition=attachment; filename="Coma.mp3" Content-Encoding=gzip Vary=Accept-Encoding Keep-Alive=timeout=15, max=100 Connection=Keep-Alive Content-Type=audio/example Thanx Link to comment https://forums.phpfreaks.com/topic/182610-cache-control-not-being-set-php/ Share on other sites More sharing options...
dreamwest Posted November 23, 2009 Share Posted November 23, 2009 is it all mp3 files? Link to comment https://forums.phpfreaks.com/topic/182610-cache-control-not-being-set-php/#findComment-963803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.