scalatra/scalatra — Issue #159: SslRequirement trait doesn't handle ports 8080 and 8443 by default
Author: sroebuck
Created: 2012-02-22 13:21:48+00:00
State: open

Now that the `xsbt-web-plugin` (version 0.11.2) has support for easily testing SSL on a local server which would normally default to port 8080, it would be handy if the `SslRequirement` trait supported this out of the box, redirecting to port `8443`. It just means changing:

val oldUri = new URI(req.getRequestURL.toString)
val url = new URI("https", oldUri.getAuthority, oldUri.getPath, oldUri.getQuery, oldUri.getFragment).toString

to

val oldUri = new URI(req.getRequestURL.toString)
val newPort = oldUri.getPort match {
case 80 => 443
case 8080 => 8443
}
val url = new URI("https", oldUri.getRawUserInfo, oldUri.getHost, newPort, oldUri.getPath,
oldUri.getQuery, oldUri.getFragment).toString

I'd make it a pull request but that seems like overkill.