CodeIgniter Forums
Cache Expiring - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: Cache Expiring (/thread-76560.html)

Cache Expiring - elserra - 05-25-2020

I am trying to cache images, with not luck. The response is only the image, and it works. But not the cache.

This is the only Controller (the response is the image itself and the .ico file):

PHP Code:
public function getImage($filename null)
        $basefolder 'test/';
        $filename $basefolder.$filename;
        $cacheOptions = [
            'max-age'  => DAY

And this is the response header:
HTTP/1.1 200 OK
Date: Mon, 25 May 2020 19:52:44 GMT
Server: Apache/2.4.38
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=86400
Pragma: no-cache
Debugbar-Time: 1590436364
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/jpeg

What means the expiring date of 1981 and how do I change it?

I also noticed, that the image is described as docuement in the Network analysis tab. How can I change that? Is it because I am using readfile? Is there a better option for that? Same for videos, btw.