I have very similar problem
myapp.com deployed on dokku and I NEED
www.myapp.com subdomain to point to the same app.
also I have
foo.myapp.com (deployed on dokku) but somehow
www.myapp.com always points to this app instead of root..
Did you manage to workaround this?
Try the redirects plugin, works for me.
For other folks who may run into this, this should solve the issue:
domains:add name_of_site www.domainname.extension
And, if you happen to be running Django, be sure to add ".domainname.extension" to your ALLOWED_HOSTS settings.