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
You set the port that your Play Framework application listens on by passing the http.port parameter to the “run” script for your application: -Dhttp.port=5150 Here’s an example of a command I use to execute the run script for a Play Framework application named myapp:
The framework treats these parameters as Strings. GET /categories controllers.Category.index (id: Integer ?= 0) GET /categories/:id controllers.Category.index (id: Integer) If the parameter is optional, we can specify its default value. If no specified, Play will ignore given parameter and put it a default value.
If no specified, Play will ignore given parameter and put it a default value. Accordingly in our example, both /categories and /categories/3 routes will match controllers.Category.index (int id) method.
Normally, you should see the same result as in the article about database and JPA in Play Framework. Routing is a little bit more fun than query string handling. However, they have some subtleties and to better understand them, we'll present different routing strategies in following table:
Try using the http.port=disabled flag
play -Dhttp.port=disabled -Dhttps.port=443 -Dhttps.keyStore=/path/to/keystore -Dhttps.keyStorePassword=password start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With