Is there a way to know which backend is serving the traffic?

Baliga, Ramprasad (Cognizant) 0 Reputation points
2025-02-06T19:26:36.07+00:00

We have 3 backend linux servers where nodejs application is installed. Azure application gateway is configured to route the requests to these 3 backend nodes. However, we would like to setup a custom header in Application Gateway to understand at any point in time which backend is currently serving the traffic? Is there a way to achieve this in Application Gateway?

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,124 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 1,120 Reputation points
    2025-02-06T23:37:21.8966667+00:00

    Hello,

    Welcome to Microsoft Q&A,

    To configure Azure Application Gateway to add a custom header to responses, you can utilize its header rewrite capability. This feature allows you to insert, remove, or modify HTTP headers in both request and response messages.

    https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-portal

    You can create and set the custom header "X-Backend-Server". If you want to dynamically insert the backend server's IP address or hostname, you can use server variables like {server_name} or {server_ip}.

    After defining the rule, associate the rewrite set with the appropriate listener or routing rule.

    Please Upvote and accept the answer if it helps!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.