Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 在finatra应用程序中禁用http_Scala_Heroku_Https_Finagle_Finatra - Fatal编程技术网

Scala 在finatra应用程序中禁用http

Scala 在finatra应用程序中禁用http,scala,heroku,https,finagle,finatra,Scala,Heroku,Https,Finagle,Finatra,我正在向Heroku部署Finatra应用程序。多亏了推特人和Heroku,这是一项非常简单的任务。问题是Heorku提供了现成的https(如果我试图通过https访问我的服务,它就可以正常工作)。不过,它也适用于http请求。有没有办法禁用http请求而只保留https 谢谢您可以通过将defaultHttpPort值重写为空字符串来禁用http请求(并且不要传递-http.port标志的值) 我建议设置一个重定向,将所有http://请求路由到https://how 你会那样做吗? imp

我正在向Heroku部署Finatra应用程序。多亏了推特人和Heroku,这是一项非常简单的任务。问题是Heorku提供了现成的https(如果我试图通过https访问我的服务,它就可以正常工作)。不过,它也适用于http请求。有没有办法禁用http请求而只保留https


谢谢

您可以通过将defaultHttpPort值重写为空字符串来禁用http请求(并且不要传递-http.port标志的值)


我建议设置一个重定向,将所有http://请求路由到https://how 你会那样做吗?
import com.twitter.finagle.Http
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.routing.HttpRouter

object ExampleHttpsServerMain extends ExampleHttpsServer

class ExampleHttpsServer
  extends HttpServer
  with Tls {

  override val defaultHttpPort: String = "" // disable the default HTTP port
  override val defaultHttpsPort: String = ":443"

  override def configureHttp(router: HttpRouter): Unit = {
    router
      .add[ExampleController]
  }
}