title: Symfony - BinaryFileResponse returns a ResponseHeader, but no file
body: <p>currently trying to serve a static PDF file that is not within the web directory ($reasons).</p>
  
  <p>I applied</p>
  
  <pre><code>$filepath = $this-&gt;getTargetFile($level, $name);
  
  $response = new BinaryFileResponse($filepath);
  $response-&gt;headers-&gt;set('Content-Type', 'application/pdf');
  $response-&gt;setContentDisposition(
      ResponseHeaderBag::DISPOSITION_INLINE,
      $filename
  );
  return $response;
  </code></pre>
  
  <p>and Profiler shows that there is a Response with correct headers, but there is no document view and no download prompt whatsoever. Is there something I am missing?</p>
  
  <pre><code>/** Get target file */
  public function getTargetFile($level, $name)
  {
      return $this-&gt;kernel-&gt;locateResource($staticPath . $level . '/' . $name);
  }
  </code></pre>