# Cache-control headers

**URL:** <https://discourse.slimframework.com/t/cache-control-headers/636>\
**Category:** Questions\
**Created:** [August 19, 2016, 9:27pm UTC](https://discourse.slimframework.com/t/cache-control-headers/636 "2016-08-19T21:27:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cotthemh](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@cotthemh](https://discourse.slimframework.com/u/cotthemh)\
**Post date:** [August 19, 2016, 9:27pm UTC](https://discourse.slimframework.com/t/cache-control-headers/636/1 "2016-08-19T21:27:19Z")

</div>

I’m trying to set the cache control headers, i tried the slim/http-cache and a few other options, but i cannot get a cache-control enabled. the browser keeps adding a line:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0

so the cache does not work, this used to work fine in slim 2 its basically the same application.  
to make things more clear i setup a middleware route:  
public function \_\_invoke($request, $response, $next)  
{  
$response = $next($request, $response);//execute the transaction  
$response = $response-\>withoutHeader(‘Cache-Control’);  
$response=$response-\>withHeader(‘Cache-Control’, “max-age=2400”);

```
    return $response;
}

```

but this does not remove the cache-control line.

my htaccess looks like this:  
Header always set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Accept"  
Header always set Access-Control-Max-Age "1000"  
Header always set Access-Control-Allow-Methods "HEAD, PUT, GET, POST, DELETE, OPTIONS"  
Header always set Access-Control-Allow-Credentials "true"  
RewriteEngine On  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(._)$ %{ENV:BASE}index.php [QSA,L]  
RewriteCond %{REQUEST\_METHOD} OPTIONS  
RewriteRule ^(._)$ $1 [R=200,L]

what part am i missing?

thanks for your feedback,

kind regards,

H
