Disable http in finatra app

I am using Finatra app for Heroku. Thanks to the guys at Twitter along with Heroku, this is a very easy task. The thing is, Heorku gives you https out of the box (if I try to reach my service via https, it just works). However, it also works with http requests. Is there a way to turn off HTTP requests and leave only https?

thank

+3


source to share


1 answer


You can disable the http request by overriding the defaultHttpPort value to an empty string (and not passing a value for the -http.port flag)



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]
  }
}

      

0


source







All Articles