I have a secured website (using https certificate and WAF) balanced by the Azure application gateway. The problem is that when browsing the website without www then I got the error message that this site is not secured while if I add www.domainname.com I get the secured website. I tried in the application gateway a feature called Host Type Multiple/Wildcard as in the following screenshot

But that did not work. So the question is: How to redirect https://domaionname.com to https://www.domainname.com
I tried to reproduce the same in my environment and got the results successfully like below:
Once you create Application gateway and point it’s IP address to your custom domain name such as to redirect
https://domaionname.comtohttps://www.domainname.comyou can add another listener with hostname “www.example.com” and make sure that the previous listener with hostname “example.com” redirects to the newly added listener.Try to add another listener HTTPS like below:
So, 2 HTTPs listeners with hostnames - one without www and one with www. Add a rule to redirect without www HTTPS listener to with www HTTPS listener.
And another rule to make sure that with www HTTPS listener is bound to a backend pool to serve the traffic like below:
Application gateway rule to redirect the listener 1 to listener 2.
I created a new rule for listener 2 to use the HTTPS settings to send traffic to my backend pool.
Now Application gateway for domain name redirect to
https://www.domainname.comsuccessfully like below: