重定向http请求到https(喷io/scala)
Redirect http request to https (spray io/scala)
如何将我的 http
请求重定向到 https
?虽然这是一个常见问题,但我没有看到 spray io
.
的任何解决方案
- 我已经使用 Apache
CamelSslConfiguration
启用了 ssl,效果很好。
- 我已经设置端口转发 (iptables) 从 80 -> 8081 和 443 -> 8081
下面是我的Boot.scala文件
object Boot extends App with CamelSslConfiguration with ApiScheduler {
// we need an ActorSystem to host our application in
implicit val system = ActorSystem("on-spray-can")
// create and start our service actor
val service = system.actorOf(Props[ApiServiceActor], "api-service")
implicit val timeout = Timeout(50.seconds)
// start a new HTTP server on port 8080 with our service actor as the handler
IO(Http) ? Http.Bind(service, interface = "0.0.0.0", port = 8081)
}
我终于在 Spray IO google 组的帮助下完成了这项工作。
总结了一切
如何将我的 http
请求重定向到 https
?虽然这是一个常见问题,但我没有看到 spray io
.
- 我已经使用 Apache
CamelSslConfiguration
启用了 ssl,效果很好。 - 我已经设置端口转发 (iptables) 从 80 -> 8081 和 443 -> 8081
下面是我的Boot.scala文件
object Boot extends App with CamelSslConfiguration with ApiScheduler {
// we need an ActorSystem to host our application in
implicit val system = ActorSystem("on-spray-can")
// create and start our service actor
val service = system.actorOf(Props[ApiServiceActor], "api-service")
implicit val timeout = Timeout(50.seconds)
// start a new HTTP server on port 8080 with our service actor as the handler
IO(Http) ? Http.Bind(service, interface = "0.0.0.0", port = 8081)
}
我终于在 Spray IO google 组的帮助下完成了这项工作。
总结了一切