Search code examples
grailshttps

Change Grails 3 URL to HTTPS


I have setup SSL within my Grails 3.3 application as follows and it works appropriately.

environments:
    development:
        server:
                port: 8443
                ssl:
                  enabled: true
                  key-store: './localkeystore'
                  key-store-password: 'localonly'
                  key-password: 'localonly'

However, I have to manually change the URL to https in the browser. I am using IntelliJ IDEA to deploy locally with the Gradle bootRun command. The deployment log shows the URL upon deployment as unsecure. How can I change this URL to https?

Grails application running at http://localhost:8080/application in environment: development


Solution

  • If you are running the application with the Gradle bootRun command:

    Open build.gradle file and add following configuration there:

    bootRun {
        systemProperty 'server.port', '8443'
        systemProperty 'server.ssl.enabled', 'true'
        systemProperty 'server.ssl.key-store', './localkeystore'
        systemProperty 'server.ssl.key-store-password', 'localonly'
        systemProperty 'server.ssl.key-password', 'localonly'   
    }
    

    Hope this helps you.