GitLab Pages custom domain allow www
The configurations in the question are correct, what I didn't do is add both mydomain.com
and www.mydomain.com
as domains in GitLab (Settings icon > Pages > New Domain).
GitLab then directs traffic to both www and the naked domain when both domains are listed.