How to disable http port in play framework?

2020-03-01 09:51发布

问题:

When I run Play Framework using https port, application starts on two ports - default (9000) and https (443). How to disabled default 9000 port and run the Play application ONLY on https port?

I run application through the following command:

play -Dhttps.port=443 -Dhttps.keyStore=/path/to/keystore -Dhttps.keyStorePassword=password start

I get some logs:

[info] play - Application started (Prod)
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
[info] play - Listening for HTTPS on port /0:0:0:0:0:0:0:0:443

回答1:

Try using the http.port=disabled flag

play -Dhttp.port=disabled -Dhttps.port=443 -Dhttps.keyStore=/path/to/keystore -Dhttps.keyStorePassword=password start


回答2:

Unfortunately this can't be done in the same way in the Gradle Play Plugin, See: https://github.com/gradle/playframework/issues/85