Www and non-www certificates in Docker

I want users to be able to navigate to www.mydomain.com or just mydomain.com but as far as I can tell, there is only the option to assign and get certificates for a single domain when using Docker (I’m using it with the AWS provisioning). Can I do it? and if so, how?

I had the same issue with a landing page I launched on Linode with Docker. I have just left it for now but please let me know your solution when you figure it out.

1 Like

We have to add more options for this when using traefik to issue certificates and do redirects, see:

Thanks @george, I know these can be a small can of worms. Maybe domains could be added but only if they redirect to the ‘master’ domain via htaccess? That way cookies etc. will only nee to be served for one domain but would allow the most common www/non-www issue to be resolved.

For now, as a workaround, I added:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]
RewriteRule ^(.*)$ https://mydomain.com/$1 [R=301]

to the htaccess file and then altered the docker-compose.yml file (under .wappler/targets/targetname) from:



traefik.http.routers.dockername__targetname_web-secure.rule=Host('www.mydomain.com') || Host('mydomain.com')

Use back ticks around the host names (they just won’t show on posts)

All traffic is now routed to the non-www version and secured with a valid certificate.

This has worked for me so far but I haven’t tried changing docker settings etc. so may well get overwritten.


Yes I’m planning to add something similar in the settings. The redirect can also be done with traefik rules so no need to change any htaccess.