Azure App Services Header - X-Forwarded-For - Rewrite

adscreen 0 Reputation points
2024-05-04T21:27:18.55+00:00

Hello everyone

Currently I have an App Service running a Docker Container and an Application Gateway because I need to customize the header X-Forwarded-For. Here you can find the current rules I have created:

User's image

But since the Application Gateway is relatively expensive and I only need it because of this rule, I was wondering if there is another way to do this directly in the App Service or if there is another cheaper way to do this.

Best regards

Adrian

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,407 questions
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 5,560 Reputation points
    2024-05-05T05:22:12.83+00:00

    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:

    1. 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 the X-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 the X-Forwarded-For header.
    2. 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 the X-Forwarded-For header to the desired value, such as the add_x_forwarded_for_proxy server variable.
    3. 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

    0 comments No comments