Reputation: 11
I have an azure web app and its corresponding application gateway. I have created a CNAME and pointed it to the DNS name of the app gateway.
Now when I access the site using the CNAME, it reaches the app gateway and redirects me to the web app(actual web app URL ...azurewebsites.net).
Is it possible that using the CNAME, I should be able to reach the web app i.e. on the address bar it should be displaying the same CNAME to reaching the web app(it should not redirect to the web app)
Thanks.
Upvotes: 0
Views: 2346
Reputation: 28274
You could configure the custom domain like sub.example.com
to the web app first, then you could add such custom domain in the hostnames of Azure web app service. Once the DNS propagation happens, the CNAME record of the custom domain in the DNS zone should be changed to map the FQDN of the Application gateway like xxx.cloudapp.net
.
I test this using web app service without HTTPS redirection. HTTPS Only
is off
. Azure Application Gateway is also working for HTTP. If you want to use HTTPS for the web app, you need an SSL cert for the custom domain.
Tutorial: Map an existing custom DNS name to Azure App Service
In this case, you properly set HTTPS only
is on
in the custom domains of Azure web app service. For me, I could still set "Pick up hostname from the backend pool" under the HTTP setting even I do not add the hostnames as my previous reply. The redirection actually is related to the "HTTPS only" under Custom Domain in Azure web app.
Upvotes: 0
Reputation: 11
I got this issue fixed: The redirection that was occurring was due to a setting "Pick up hostname from the backend pool" under HTTP setting of application gateway. Removing that setting, using the CNAME we were able to reach the web app but we were getting an error "Too_Many_redirects" and this was resolved once the "HTTPS only" is set to off on the web app under Custom Domain as this redirection was configured at the gateway level.
Upvotes: 0