0

I have a tiny project based on the template from official Scalatra tutorial. I read it's possible to setup jetty to support HTTPS, but I have no idea how to do that.

Is it possible to enable HTTPS support in Scalatra (jetty) without other standalone software (e.g. nginx) wrapping communication? If so, how to do that?

menfon
  • 1,587
  • 1
  • 11
  • 28

1 Answers1

0

All you need is install java and sbt. Intruction here: http://scalatra.org/getting-started/installation.html and after creating project you will have in build.sbt

libraryDependencies ++= Seq(
  "org.scalatra" %% "scalatra" % ScalatraVersion,
  "org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
  "ch.qos.logback" % "logback-classic" % "1.2.3" % "runtime",
  "org.eclipse.jetty" % "jetty-webapp" % "9.4.19.v20190610" % "container",
  "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
)

and jetty will be downloaded automatically by sbt. You don't need to install anything else i.e. jetty or nginx. Jetty is a Java web-server library, it can receive and send requests by https. It works on jvm and don't need some addition software.

Boris Azanov
  • 4,408
  • 1
  • 15
  • 28
  • Yes, jetty works, but not for https. `lsof -i -P | grep 14994` (`14994` is the jetty process) returns only single line - http on 8080. I even tried accessing the 8080 port as https and it failed. – menfon Jan 27 '20 at 07:08
  • for https you need have ssl-certificate, you can use instruction here https://www.thesslstore.com/knowledgebase/ssl-install/jetty-java-http-servlet-webserver-ssl-installation – Boris Azanov Jan 27 '20 at 10:03