Show Maintenance domain if web app is stopped

70 Views Asked by At

I have created static site on azure account and I want to show that domain if my web app is stopped is there any way to do that using azure cdn.

I dont have front door or app gateway

I tried using azure cdn rule but its not redirecting domain

1

There are 1 best solutions below

0
On

AFAIK using azure CDN it's not supported you can redirect via Application gateway and blob storage should be directly accessible as storage accounts fronted by Azure CDN services are currently not supported.

In my Azure Application gateway, I am able to access site like below:

enter image description here

If you want to show that domain if my web app is stopped, you can use custom error page like below:

In Azure Application gateway -> listener add your custom error page URL which you stored in blob storage account or virtual machine to host an error page like below:

enter image description here

Now when my web app is stopped, or there is any malicious traffic Application Gateway will redirect to the custom error page like below:

enter image description here

enter image description here

You can create Global level error pages that are applied to all the listeners of Application gateway using PowerShell script :

$appgw   = Get-AzApplicationGateway -Name <app-gateway-name> -ResourceGroupName <resource-group-name>
$updatedgateway = Add-AzApplicationGatewayCustomError -ApplicationGateway $appgw -StatusCode HttpStatus502 -CustomErrorPageUrl "http://<website-url>"
Set-AzApplicationGateway -ApplicationGateway $appgw

Output:

ResourceGroupName Name Location Sku Name    Policy Name EnableHttp2 EnableFips ForceFirewallPolicyAssociation OperationalState ProvisioningState Identity
----------------- ---- -------- --------    ----------- ----------- ---------- ------------------------------ ---------------- ----------------- --------
        imran      app1 eastus   Standard_v2             True                                                  Running          Succeeded    

enter image description here

Reference:

Create Azure Application Gateway custom error pages | Microsoft Learn