How to add security headers in Azure


Our web application link in azure is After that we have created custom dns in azure and updated as After creating this, we have a request from security that we need to enable WAF for public apps So we have to enable WAF and we have provided CName and domain Name to the WAF team CName : FinalDomain : CloudWAF name was provided by them (check below) and we were asked to update our CName DEV: --> CNAME: PROD: --> CNAME: So we have updated this Value like below inplace of And after that informed WAF team about updation. Then they provided security headers and asked to update in portal


Where we have to add this security headers in portal - Access restriction or in configuration or in application insights. Only if we add this security header: will not be accessible

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

1 answer

Sort by: Most helpful
  1. Luis Arias 3,766 Reputation points

    Hi Rangasamy Sakthikrishna CNN FIXP51,

    First I advise to don't share confidential information by communities. About your questions:

    How to Add this security headers? This will depends on your application code or configuration, for example if you are using C# can use something like this:

    app.Use(async (context, next) =>
        var headerValue = Environment.GetEnvironmentVariable("ZF_SECURE_WAF_HEADER");
        context.Response.Headers.Add("ZF-SECURE-WAF-HEADER", headerValue);
        await next.Invoke();

    Additionally, In order to don't hardcode this values on your code you can add this headers values in the App Service > Configuration > Application Settings in the Azure portal, these values are made available to your application as environment variables and Your can retreive by this way.

    User's image

    Let me know if this information help you to address your question.