HttpsRedirect
object HttpsRedirect
Middleware to redirect http traffic to https.
Inspects X-Forwarded-Proto
header and if it is set to http
,
redirects to Host
with same URL with https schema; otherwise does nothing.
This middleware is useful when a service is deployed behind a load balancer
which does not support such redirect feature, e.g. Heroku.
Value members
Concrete methods
logger.debug(_root_.scala.StringContext.apply("Redirecting","","tohttpson","").s(req.method,req.uri,host))
valauthority:Authority={
valhost$1:RegName=RegName.apply(http4sHeaderSyntax[Host](host)(headerInstance).value)
valuserInfo$1:Option[UserInfo]@uncheckedVariance=Authority.$lessinit$greater$default$1
valport$1:Option[Int]@uncheckedVariance=Authority.$lessinit$greater$default$3
Authority.apply(userInfo$1,host=host$1,port$1)
}
vallocation:Uri=req.uri.copy(scheme=Some.apply[Scheme](Scheme.https),authority=Some.apply[Authority](authority),req.uri.copy$default$3,req.uri.copy$default$4,req.uri.copy$default$5)
valheaders:Headers=Headers.apply(modelledHeadersToRaw[Location](Location.apply(location))(headerInstance),modelledHeadersToRaw[Content-Type](Content-Type.apply(MediaType.text.xml))(headerInstance))
valresponse:Response[G]=Response.apply[G](status=MovedPermanently,Response.apply$default$2[G],headers=headers,Response.apply$default$4[G],Response.apply$default$5[G])
F.pure[Response[G]](response)
case_=>
http.apply(req)
}))" class="documentableAnchor">
def
logger.debug(_root_.scala.StringContext.apply("Redirecting","","tohttpson","").s(req.method,req.uri,host))
valauthority:Authority={
valhost$1:RegName=RegName.apply(http4sHeaderSyntax[Host](host)(headerInstance).value)
valuserInfo$1:Option[UserInfo]@uncheckedVariance=Authority.$lessinit$greater$default$1
valport$1:Option[Int]@uncheckedVariance=Authority.$lessinit$greater$default$3
Authority.apply(userInfo$1,host=host$1,port$1)
}
vallocation:Uri=req.uri.copy(scheme=Some.apply[Scheme](Scheme.https),authority=Some.apply[Authority](authority),req.uri.copy$default$3,req.uri.copy$default$4,req.uri.copy$default$5)
valheaders:Headers=Headers.apply(modelledHeadersToRaw[Location](Location.apply(location))(headerInstance),modelledHeadersToRaw[Content-Type](Content-Type.apply(MediaType.text.xml))(headerInstance))
valresponse:Response[G]=Response.apply[G](status=MovedPermanently,Response.apply$default$2[G],headers=headers,Response.apply$default$4[G],Response.apply$default$5[G])
F.pure[Response[G]](response)
case_=>
http.apply(req)
}))" class="documentableName ">apply[F[_], G[_]](http: Http[F, G])(implicit F: Applicative[F]): Http[F, G]