How to configure a custom error 404 page in azure app service

Neerav Agrawal 45 Reputation points

How to configure a custom error 404 page in azure app service

In configurations -> error pages - I do see the options for 403, 502, 503 error pages only. But not sure how to configure 404 page?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,532 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 16,776 Reputation points Microsoft Employee

    @Neerav Agrawal apologize for the delay in my response. You might have missed to attach the output what you are getting.
    Custom error pages are for errors that terminate on the FrontEnd (ie, request that doesn't make to your app). In this sense a 404-error page is not meaningful, since when a 404 comes from the FrontEnd it means we were unable to find a site for a hostname in the first place! 

    Once the request gets to the app it is assumed the customer can use whatever error page they want.

    I have written the below custom error config in my web.config file and test it as well. All the requests coming to the root url of the webapp it is showing the default page if we request to the path which doesnt exists in my application. it is redirecting the content in 404.html file. As shown below.

            <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
                  <remove statusCode="404" subStatusCode="-1" />
                  <error statusCode="404" path="/404.html" responseMode="ExecuteURL" />

    User's image

    0 comments No comments