Thanks for posting your question in the Microsoft Q&A forum.
There are a few alternative approaches you can consider that may be more cost-effective than using an Application Gateway:
- Azure Front Door Service: Azure Front Door is a global load balancer and application delivery network service that can act as a reverse proxy for your App Service. it supports rewriting the
X-Forwarded-For
header by using theX-Forwarded-For
rule engine. while not as feature-rich as Application Gateway, Azure Front Door may be a more cost-effective option for your specific use case of rewriting theX-Forwarded-For
header. - Azure API Management: Azure API Management is a service that can act as a reverse proxy for your App Service. it allows you to modify request and response headers through policies, including the
X-Forwarded-For
header. you can create a policy to set theX-Forwarded-For
header to the desired value, such as theadd_x_forwarded_for_proxy
server variable. - Azure Functions Proxy: You can create an Azure Function that acts as a proxy for your App Service. within the Azure Function, you can modify the
X-Forwarded-For
header before forwarding the request to your App Service. this approach requires some additional development effort but can be a cost-effective solution if you already have Azure Functions in your architecture.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful