Permalink
Browse files

Including the X-SSL header allows for correct SSL detection through a…

… reverse proxy
  • Loading branch information...
1 parent efe3ca8 commit 86e7b30a0b1a4b2027ca6420627f402475b37a21 @dpp dpp committed May 28, 2012
@@ -997,6 +997,7 @@ class Req(val path: ParsePath,
*/
lazy val hostAndPath: String =
containerRequest.map(r => (r.scheme, r.serverPort) match {
+ case ("http", 80) if r.header("X-SSL").isDefined => "https://" + r.serverName + contextPath
case ("http", 80) => "http://" + r.serverName + contextPath
case ("https", 443) => "https://" + r.serverName + contextPath
case (sch, port) => sch + "://" + r.serverName + ":" + port + contextPath
@@ -226,7 +226,10 @@ private class OfflineRequestSnapshot(req: HTTPRequest, val provider: HTTPProvide
val scheme: String = req.scheme
- val serverPort: Int = req.serverPort
+ lazy val serverPort: Int = req.serverPort match {
+ case 80 => headers("X-SSL").flatMap(Helpers.asBoolean _).filter(a => a).map(a => 443).headOption getOrElse 80
+ case x => x
+ }
val method: String = req.method

0 comments on commit 86e7b30

Please sign in to comment.