how to dynamically pass play.filters.hosts.allowed to a server

I am looking for a simple way of passing the play.filters.hosts.allowed parameter to a production play server started via a docker container.

Any advice on best practices to do this? shows how to override configuration parameters by using system properties and environment variables. But it is unclear how/whether this mechanism can be used for a list-valued configuration such as play.filter.hosts.allowed.

Is it necessary in this case to create a special prod.conf file or is there a simpler way to specify the production play.filters.hosts.allowed configuration?

Many thanks.


It should be possible to do -Dplay.filters.hosts.allowed.0=foo -Dplay.filters.hosts.allowed.1=bar. See


Great. That worked.

Thank you so much for the tip.


Apart from using these parameters, is it possible to change the allowed hosts entries programmatically with Scala/Java (e.g. based on entries in the database)?
All the best

You can do it, but you’ll have to either create your own filter or bind your own instance of AllowedHostsConfig. It should be pretty straightforward though. Take a look at what the current code does and it should give you an idea: