Created
March 12, 2012 19:06
-
-
Save hamnis/2024017 to your computer and use it in GitHub Desktop.
unfiltered responsefunction for detecting heroku https
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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