Installing letsencrypt for both www and non-www domains in dokku


1. If the domain for the app was set on the non-www domain, then add the www domain to the app, and vice-versa.
In my case, I had setup the app for the non-www domain which was accessible at
So had to run,

dokku domains:add app-name

// A little confused on the above command if it is :add or :set. Need to confirm
To check if the domain has been added to the list, you can run

dokku domains:report // for all the apps
dokku domains:report app-name // for the specific app

2. Check to make sure that there are no redirects set on the app.

dokku redirect

If you don’t find any list, probably means that there is no redirect set. But if you find any redirects, make sure to rem,ove them before proceding, else the issuance of the letsencrypt certificate will fail.
Please check this github issue for more information.

3. If there are redirects set, then follow this point. else can skip.

dokku redirect:unset app-name

Follow this step for all the redirects that have been in place for the current app. Run the previous list command point again to check if all redirections have been removed.

4. Run the letsencrypy command to install the certificate for the given app.

dokku letsencrypt app-name

This will encrypt all the domains that have been set for the app.

5. Then add the redirect domains back again (if any)
This is for the guys who followed point no 2 for removing redirection

dokku redirect:set app-name

And follow the structure for all the redirects.

Leave a Reply