Hi @Zenith Nandy
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
Application Gateway automatically adds the X-Forwarded-For header to every incoming request before forwarding it to the backend. This header includes a comma-separated list of IP addresses with ports, but some backend applications only require the IP addresses without the port numbers. You can use Header Rewrite to strip the port information. The recommended approach is to rewrite the header using the add_x_forwarded_for_proxy server variable, which inserts only the client IP addresses without ports.
As mentioned in the Application Gateway header rewrite limitations.
Rewrites aren't supported for 4xx and 5xx responses generated directly from Application Gateway
Reference: https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-url#limitations
You may want to remove headers that expose sensitive information in an HTTP response such as backend server details, operating system, or library versions. The Application Gateway allows you to strip these headers for enhanced security. follow the Delete unwanted headers to delete unwanted header information.
Refer the https://learn.microsoft.com/en-us/answers/questions/1409227/application-gateway-server-information-disclosure which related to same issue
In addition to your previous question, please see the response below.
Is it a security vulnerability if I leave the header as-is?
No — this is not a security vulnerability.
The header:
YAML
Server: Microsoft-Azure-Application-Gateway/v2
does not expose any sensitive details such as OS version, framework version, internal server configuration, or exploitable information.
What does “v2” signify, and is it safe for it to appear?
Yes, it is completely safe.
The “v2” label simply indicates the generation of the Azure Application Gateway SKU. It does not disclose internal patch levels, component versions, or anything that could assist an attacker.
Keeping this header unchanged is not a security risk, and the presence of “v2” in the header is fully acceptable and safe.
Reference: https://learn.microsoft.com/en-us/azure/application-gateway/overview-v2#sku-types
If it is storing any sensitive information, you can create a rewrite rule to remove or modify the header.
Reference: https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-url#limitations
Kindly let us know if the above helps or you need further assistance on this issue.
Please "Accept" if the information helped you. This will help us and others in the community as well.