Skip to content

Instantly share code, notes, and snippets.

@hamnis
Created March 12, 2012 19:06
Show Gist options
  • Save hamnis/2024017 to your computer and use it in GitHub Desktop.
Save hamnis/2024017 to your computer and use it in GitHub Desktop.
unfiltered responsefunction for detecting heroku https
object HerokuRedirect {
def apply[A, B](req: HttpRequest[A], path: String): ResponseFunction[B] = {
val absolutepath = if (path.startsWith("/")) path else "/" + path
req match {
case XForwardProto("https") & Host(host) => Found ~> Location("https://%s%s".format(host, absolutepath))
case _ => Redirect(path)
}
object XForwardProto extends StringHeader("X-Forward-Proto")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment