Azure Web App getting 404 when using the IP Address

5,455

You would simply click the Add Hostname, and add www.whateverdomain.com in. At that point, Azure will try to verify the new hostname... So you will want to have the DNS already setup to point to your Azure IP for the web app. You could try it without DNS setup, it may have other options now (It seems like every time I login lately, that azure has new features/options). Worst case scenario you will need to remove the custom name and re-add it.

If you are just looking to test something on your webapp and do not own a custom domain or do not want to wait for DNS etc, you can modify your hosts file on your local workstation. Assuming a Windows OS, modify the file: c:\windows\system32\drivers\etc\hosts At the end of the file add a new line with your IP, space, your domain name. So:

1.2.3.4 www.whateverdomain.com

Then you will be able to browse to www.whateverdomain.com and it should work.

Azure I believe is looking for the host headers. With this hosts file trick, your machine will send the host header in the request that Azure is looking for.

Share:
5,455

Related videos on Youtube

Maddock
Author by

Maddock

Updated on September 18, 2022

Comments

  • Maddock
    Maddock over 1 year

    I need to update the dns of my domain to the Azure Web App IP, however, upong testing it on the browser, this is the result:

    screenshot 1

    I googled around and found this:

    First scenario

    If you, as an app owner, are using a custom domain with an Azure Web App, then Azure needs to be configured for recognizing the custom domain name, so that it can route the request to the appropriate server in the region.

    After registering the domain with a domain provider and configuring a DNS CNAME record to point to the app's Azurewebsites.net address (for example, wordpressbyayush.azurewebsites.net), the web app owner also needs to go to the Azure Portal and configure the app for the new domain.

    Second scenario

    The Web App is stored in a data center located in the region that the Web App owner has selected while creating the app. Azure's DNS server resolves the Web App address that was chosen for it to that data center.

    DNS servers are in charge of resolving the name of the server that the user is trying to reach into an IP address, but clients cache this information in order to be able to load the page as fast as possible. If this app was deleted and re-created in another region, the new app will have a different IP address, but the client might still be caching the old IP address.

    However, it's not clear enough. This is my custom domain screen:

    screenshot 2

    How do I add the custom domain name?!

    And for the love of all that's holy, why can't I access the website through the IP address? If I set my domain A to that IP, will it work? I have my doubts now.