Cache - Image served from controller
<p>I have images that I'd like to serve to my users with a year of validity.</p>

<pre><code>$file = $fileService-&gt;getFile($imageFilepath);
$headers = array(
    'Content-Type' =&gt; $file-&gt;getMimeType(),
    'Content-Disposition' =&gt; 'inline; filename="img.'.$file-&gt;getExtension().'"'
);
$response = new Response(file_get_contents($file), 200, $headers);
$response-&gt;setExpires(new \DateTime('+1 year'));

return $response;
</code></pre>

<p>I can see from my browser console the headers are well set but the image is always <code>GET 200 OK</code>.</p>

<p>I also tried <code>Cache-Control</code> &amp; <code>ETag</code>, still getting the image fetched from the server.</p>

<p>How can this happen ? <strong>How can I return this image valid for a year ?</strong></p>