Play framework: Why does https url not work on using “sbt dist” command?

末鹿安然 提交于 2020-04-16 04:26:21

问题


I am trying to create executable file for deploying my web app using play framework sbt dist command. When I run my application using "sbt run" command then https work but when I use sbt dist and run my executable file to start my app then only http url works.

Following is my configuration

In build.sbt

javaOptions ++= Seq(
  "-Dhttps.keyStore=conf/keystore.jks",
  "-Dhttps.keyStorePassword=*****",
  "-Dhttp.port=9000",
  "-Dhttps.port=9001",
  "-Dsentry.dsn=https://****"
)

In application.conf

play.http {

  session {
    secure = true
    httpOnly = true
    domain = "localhost"
  }

  flash {
    secure = true
    httpOnly = true
  }
}

play.ws {
  ssl {
    trustManager = {
      stores = [
        { type = "JKS", path = "conf/keystore.jks" }
      ]
    }
  }
}


回答1:


You need to define the javaOptions in Universal:

javaOptions in Universal ++= Seq(
  "-Dhttps.keyStore=conf/keystore.jks",
  "-Dhttps.keyStorePassword=*****",
  "-Dhttp.port=9000",
  "-Dhttps.port=9001",
  "-Dsentry.dsn=https://****"
)

See https://www.scala-sbt.org/sbt-native-packager/archetypes/java_app/customize.html#via-build-sbt

However, why not just define those settings in conf/application.conf?



来源:https://stackoverflow.com/questions/60887982/play-framework-why-does-https-url-not-work-on-using-sbt-dist-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!