Unable to set up custom error pages in APP GW

T1.Cantus 0 Reputation points
2025-02-10T17:48:37.8066667+00:00

I am unable to set up custom error pages in APP GW due to limitations in my business's policy that cannot be changed.

All storage accounts must be private with no internet access.
All resources must be deployed in UK therefore ruling out azure static web app.

I have tried - redirecting via condition that the http status is not 200 - this does not work.
I have tried pointing to a private endpoint from app gw custom error pages but only a html page is accepted.
I have attempted, rewrites and redirects using the rules in application gateway but the following are listed as requirements/ limitations of such setups.

  • know the corresponding remote location (URL) for the HTML page. This must be a publicly accessible file.
  • ensure the error page is publicly accessible and return a 200 response.
  • ensure the error page should be in *.htm or *.html extension type.
  • ensure the page size is less than 1 MB.
  • ensure the network access settings are set to "enabled from all networks" when using an Azure Blob storage account.
  • Rewrites aren't supported when the application gateway is configured to redirect the requests or to show a custom error page.
  • Request header names can contain alphanumeric characters and hyphens. Headers names containing other characters will be discarded when a request is sent to the backend target.
  • Response header names can contain any alphanumeric characters and specific symbols as defined in RFC 7230.
  • Connection and upgrade headers cannot be rewritten
  • Rewrites aren't supported for 4xx and 5xx responses generated directly from Application Gateway

Is there any way of setting up custom error pages in this scenario for the public listeners?

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,130 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rohith Vinnakota 2,720 Reputation points Microsoft Vendor
    2025-02-10T22:01:48.9133333+00:00

    @T1.Cantus

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    If you want to set up the custom error pages in the application using storage blob we have enable the “enabled from all networks” in the network access settings of the storage.

    How do error pages work in the application gateway?

    After you specify an error page in your application gateway's configuration, your gateway verifies the connectivity to the HTML page over the internet. It then downloads the file on its local cache.

    Refer this link for details:

    Create Azure Application Gateway custom error pages | Microsoft Learn

    One possible way you can achieve this: As I mentioned above, we need to enable access from all networks in the storage. The application gateway verifies the error file and downloads it to the local cache. After that, we must disable all networks. The error file is then used from the local cache.

    You can host the error page on the VM. User's image

    Or  

    Create the new storage account and enable all networks in the storage to host the error page in the application gateway.

    Note: Application gateway doesn't periodically check the source file's location to fetch a new version. You can perform any configuration update on the gateway to manually update the file's cache. 


    I hope this has been helpful!

    Your feedback is important so please take a moment to accept answers. If you still have questions, pleaslet us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.