javahttpsplayframeworkplayframework-1.x

How can I run Play framework in HTTPS only in the dev mode?


I'd like to run Play Framework over HTTPS only in the development mode and I've done so using the following bit of configuration:

https.port=9443
trustmanager.algorithm=JKS
keystore.file=conf/certificate.jks
keystore.password=password
certificate.password=password
application.mode=dev
%prodenv.application.mode=prod

This works when I run play run but in production we run play run --%prodenv and I want to disable HTTPS as the HTTPS is handled by Nginx. I'm lost with how to do this. I would like to do this via the configuration file and not via additional command-line arguments as it does defy the purpose of having all my application configuration in the application.conf file.


Solution

  • Rather than have two configuration files, I achieved this by using just one. In order to run the app, I run play run --%dev and this is what the configuration looks like.

    %dev.https.port=9443
    %dev.trustmanager.algorithm=JKS
    %dev.keystore.file=conf/certificate.jks
    %dev.keystore.password=password
    %dev.certificate.password=password