Hello @RT-7199 ,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
I understand that you would like to know if it is possible to rewrite a domain with www using Azure Application gateway.
It should be possible via a simple listener redirect configuration in your Application gateway.
Refer : https://learn.microsoft.com/en-us/azure/application-gateway/redirect-overview
https://learn.microsoft.com/en-us/azure/application-gateway/redirect-internal-site-powershell
Once you create an Application gateway and point it's IP address to your custom domain name i.e. example.com, you should be able to access the Application gateway via that domain name. Post this if you want to make sure that the URL example.com, when accessed should redirect to www.example.com, you can just 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.
Below are the screenshots from my lab which shows the configuration and result:
- Created an Application gateway with a single HTTP multi-site listener with host name "azurelabs.tk".
- Created an "A" record to point the IP address of my Application gateway to the domain name "azurelabs.tk".
- Then created another HTTP multi-site listener with host name "www.azurelabs.tk".
- Edited the existing app gateway rule to redirect the listener 1 to listener 2.
- Created a new rule for listener 2 to forward traffic to my backend pool using the HTTP settings.
- Now. if I access my Application gateway using azurelabs.tk, it redirects to www.azurelabs.tk as below:
Kindly let us know if the above helps or you still need assistance with rewrites.
----------------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.