title: play framework2: find out if an app is running on http or https
body: <p>I'm trying to find out if a play 2 (with scala) app is running on http or https</p>
  
  <p>I tried with routes.Application.index.absoluteURL(request), like this</p>
  
  <pre><code>def chatUri(username: String)(implicit request: RequestHeader): String = {
  
    val uri = routes.Application.index.absoluteURL(request)
  </code></pre>
  
  <p>but I get the following error:</p>
  
  <pre><code>/home/sas/tmp/websocket-chat/app/controllers/Application.scala:51: overloaded method value absoluteURL with alternatives:
  [error]   (secure: Boolean)(implicit request: play.api.mvc.RequestHeader)java.lang.String &lt;and&gt;
  [error]   (play.mvc.Http.Request)java.lang.String
  [error]  cannot be applied to (play.api.mvc.RequestHeader)
  [error]     val rootUri = Uri(routes.Application.index.absoluteURL(request))
  </code></pre>
  
  <p>I tried to transform the RequestHeader into a Request, but I get the following error</p>
  
  <pre><code>val rootUri = Uri(routes.Application.index.absoluteURL(request.asInstanceOf[Request[Any]]))
  
  (secure: Boolean)(implicit request: play.api.mvc.RequestHeader)java.lang.String &lt;and&gt;
  [error]   (play.mvc.Http.Request)java.lang.String
  [error]  cannot be applied to (play.api.mvc.Request[Any])
  [error]     val rootUri = Uri(routes.Application.index.absoluteURL(request.asInstanceOf[Request[Any]]))
  </code></pre>
  
  <p>Any idea how can I achieve it?</p>