How can I intercept a custom header?

Clay Brinlee 6 Reputation points
2021-06-21T15:00:23.453+00:00

We are going to send a custom header to our classic web service and If I don't see this custom header we don't want to accept the traffic. I know this is easy to implement within the code of my web service but I don't want to have to change our code. Is there some way to check for this custom header within the Azure infrastructure instead and prevent the traffic from ever reaching my web service if it doesn't exist?

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
652 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,851 Reputation points Microsoft Employee
    2021-07-15T19:38:56.893+00:00

    @Clay Brinlee , Apologies for the delay in responding here.

    You can do this by adding WAF to Application Gateway and use a custom rule.

    Custom rules for Web Application Firewall v2 on Azure Application Gateway
    Some samples of custom rules located here: Create and use Web Application Firewall v2 custom rules on Application Gateway -Kindly check out the steps.

    Based on your requirement, you could go with the above approach. Or other approach with WAF on Azure Front Door could also be used.

    Custom rules for Web Application Firewall with Azure Front Door

    Just to provide you a good understanding on hosting website on Azure. Azure offers several ways to host websites: Azure App Service WebApps (PAAS solution), Virtual Machines (IAAS), Service Fabric and Cloud Services (/in your case) – It provides more control over the underlying infrature. On an Azure VM, you would typically perform the same steps/process as you would do on prem.
    Please see this -https://learn.microsoft.com/azure/architecture/guide/technology-choices/compute-decision-tree for more details on that topic.

    0 comments No comments