3

I am deploying a Finatra app to Heroku. Thanks to Twitter guys together with Heroku this is a very easy task. The thing is that Heorku gives you https out of the box (if im trying to reach my service through https it just works). Nevertheless it also works with http requests. Is there any way to disable http requests and leave only https?

Thanks

Gal
  • 371
  • 2
  • 14

1 Answers1

1

You can disable the http request by override the defaultHttpPort value to an empty String (and do not pass 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]
  }
}