Azure application gateway adds 6 additional headers before sending request to backend. Where we can check this headers from request response logs?

Bhargav Pasarla 120 Reputation points
2023-05-24T05:32:26.67+00:00

Azure application gateway adds 6 additional headers before sending request to backend. Where we can check this headers from request response logs?

Application gateway inserts sixadditional headers to all requests beforeit forwards therequests to the backend. These headers are

x-forwarded-for,

x-forwarded-port,

x-forwarded-proto,

x-original-host,

x-original-url,

xappgw-trace-id

Where to check this data from logs?

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

Accepted answer
  1. GitaraniSharma-MSFT 47,696 Reputation points Microsoft Employee
    2023-05-25T14:54:53.37+00:00

    Hello @Bhargav Pasarla ,

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    I understand that you would like to where can you find the 6 additional headers added by Azure application gateway before sending request to backend.

    You can check the headers added by Azure Application Gateway in the backend server logs. The headers added by Application Gateway are x-forwarded-for, x-forwarded-port, x-forwarded-proto, x-original-host, x-original-url, and x-appgw-trace-id.

    The backend server logs are the logs generated by the application running on the backend server that is serving the requests forwarded by the Azure Application Gateway. These logs can be accessed through the logging mechanism of the application running on the backend server. For example, if you are using IIS as your web server, you can check the logs generated by IIS.

    Below is a screenshot of the packet trace collected on the backend VM server behind Application gateway and you can see all the 6 headers listed:

    enter image description here

    If you want to find these headers from the Application gateway logs, I'm afraid they are not listed directly as headers but have different names and you can find them in Application gateway Access logs as below:

    • x-forwarded-for --> clientIP - IP of the immediate client of Application Gateway. If another proxy fronts your application gateway, this displays the IP of that fronting proxy + the clientPort value from the logs.
    • x-original-host --> originalHost - This field contains the original request host name.
    • x-original-url --> originalRequestUriWithArgs - This field contains the original request URL.
    • x-appgw-trace-id --> transactionId - Unique identifier to correlate the request received from the client.

    enter image description here

    Refer: https://learn.microsoft.com/en-us/Azure/application-gateway/application-gateway-diagnostics#access-log

    x-forwarded-proto and x-forwarded-port values are not available in the access logs but should be easy to find as it depends on the request and there are only a couple of options as below:

    • The valid values for x-forwarded-proto are HTTP or HTTPS.
    • X-forwarded-port specifies the port where the request reached the application gateway. For HTTP, it is 80 and for HTTP, it is 443.

    Refer: https://learn.microsoft.com/en-us/azure/application-gateway/how-application-gateway-works#modifications-to-the-request

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful