Rituparna Bhattacharya, To better assist you on this, what is your application framework?
Based on my understanding of your scenario description, that you have already tried combinations of access restrictions and URL rewrite rules by modifying the web.config file to include a rewrite rule that blocks or redirects requests to the default domain and also via Application Gateway. A rule to detect if the user has accessed the website using the Azure default domain and issue a HTTP 301 or 403. Kindly confirm if this true.
Just to clarify, firstly, App Service support HTTPS on *.azurewebsites.net
domain name and the certificate is provided and owned by Azure. By default, http://yourdomain.azurewebsites.net works even with custom domain added, and the site admins aware about the URL can access, but typically end users would not access this URL directly (unless explicitly shared).
-Kindly validate if you have similar rule:
<conditions>
<add input="{HTTP_HOST}" pattern="^(domainA.azurewebsites.net|domainB.azurewebsites.net)$" />
</conditions>
This rule may not work for the website behind a Proxy, Firewall or Application Gateways because the original host value may not be passed on to the WebApp service.
-You may consider to implement the approach to prevent Search Engines from indexing the Azure Default Domain, the key methods include configuring custom domains, using robots.txt files, and setting up appropriate DNS records. please checkout this article (by Anton Pham) for a detailed steps.
Refer similar discussion thread answered by me.
Kindly let us know how it goes, I'll follow-up with you further.