Play 2.5.x how to modify the content headers of the response i.e. for no cache?
<p>Using Scala and Play 2.5.10 I implemented the following reusable action for composition and with the aim of disabling caching in the browser by changing the response headers:</p>

<pre><code>import play.api.http.HeaderNames
import play.api.mvc._

import scala.concurrent.Future
import scala.util.{Failure, Success}
import scala.concurrent.ExecutionContext.Implicits.global

case class NoCache[A](action: Action[A]) extends Action[A] with HeaderNames {
  def apply(request: Request[A]): Future[Result] = {
    action(request).andThen {
      case Success(result) =&gt; result.withHeaders(
        (CACHE_CONTROL -&gt; "no-cache, no-store, must-revalidate"),
        (PRAGMA -&gt; "no-cache"),
        (EXPIRES -&gt; "0")
      )
      case Failure(result) =&gt; result
    }
  }

  lazy val parser = action.parser
}
</code></pre>

<p>I then reuse it in my controller action implementations like this:</p>

<pre><code>def link = NoCache {
  deadbolt.SubjectPresent()() { implicit request =&gt;
    Future {
      Ok(views.html.account.link(userService, auth))
    }
  }
}
</code></pre>

<p>I breakpoint into the <code>NoCache</code> implementation and it gets executed correctly, however, using the <a href="https://addons.mozilla.org/en-US/firefox/addon/web-developer/" rel="nofollow noreferrer">Web Developer Firefox plugin</a> to monitor the network traffic I see that the response headers do not contain the "no cache" modifications ... what'm I doing wrong?</p>