Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the http port for play framework 2.5.9

How to change the default port from 9000 to 9001 in Play 2.5.9?

Tried following steps

  1. Changed http.port = 9001 in application.conf
  2. Tried the steps mentioned in this post [a link] How to change the http port for play framework 2.4.1?

But this works activator run -Dhttp.port=9001 -Dhttp.address=127.0.0.1

Can we change it from application.conf instead of specifying port from command line?

like image 991
Sheshank Kodam Avatar asked Oct 18 '16 22:10

Sheshank Kodam


People also ask

How do I change the port number in play framework?

We are using Play version 2.5. 6. For changing the port, go to your project root folder and hit: activator "run 8008" in command prompt / terminal.

What is the default port for Play application?

Specifying the HTTP server address and port The default is to listen on port 9000 at the 0.0. 0.0 address (all addresses).


1 Answers

In a way, no you can not add HTTP server setting in application.conf in reload mode (activator run).

In run mode by the time the play server starts, your application.conf is not resolved yet, but if you use state it works fine.

If you want to avoid providing port everytime you run the command, you could add it in build.sbt as following.

PlayKeys.devSettings := Seq("play.server.http.port" -> "9001")

It is explained here

like image 135
RP- Avatar answered Nov 02 '22 21:11

RP-