Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable http port in play framework?

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

like image 705
Roman Krolikov Avatar asked Jul 21 '14 11:07

Roman Krolikov


People also ask

How do I set the port for a Play Framework application?

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:

How to get the default value of a parameter in Play Framework?

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.

What happens if no parameter is specified in play controller?

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.

What is the difference between routing and string handling in Play Framework?

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:


1 Answers

Try using the http.port=disabled flag

play -Dhttp.port=disabled -Dhttps.port=443 -Dhttps.keyStore=/path/to/keystore -Dhttps.keyStorePassword=password start
like image 176
Daniel Olszewski Avatar answered Sep 28 '22 11:09

Daniel Olszewski