Unable to see Referer in Azure Application Gateway Logs

Niraj 65 Reputation points
2025-02-19T10:09:24.7833333+00:00

Hello,
I've two domains, www.domainA.com and www.domainB.com. In Azure Application Gateway, I've a Rule written that redirects all the requests from domainA to domainB. This works well.
I'm trying to get the Referer for domainA, in Gateway logs I see all the information about domainA but that doesnt mention anything about Referer. (In short I'm trying to make a short url which is trackable so that I can know from the the link was clicked).
I even wrote a Rewrite that takes the Referer from domainA and converts it to query param so that I dont lose it while redirecting to domainB but I read in one of the stackoverflow article that Rewrites dont work on Redirects (301, 302 requests).

I've an idea of hosting an web app on domainA and trying to get the Referer there instead of sending the request to domainB but will need my clients approval. So wanted to know if there's any hope in what I'm doing initially

Thank you

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,130 questions
{count} votes

Accepted answer
  1. Praveen Bandaru 515 Reputation points Microsoft Vendor
    2025-02-19T12:08:36.18+00:00

    Hello Niraj
    Greetings!

    I understand that you created a redirection rule in the application gateway, and it is working as expected. However, to find the referrer, you will not find it in the application gateway diagnostics logs, you will only see the status code.

    In the logs, you will get the following values:

    User's image

      Kindly check the below reference doc:

    https://learn.microsoft.com/en-us/azure/application-gateway/monitor-application-gateway-reference#access-log-category

    NOTE: Rewrites aren't supported when the application gateway is configured to redirect requests or show a custom error page.

    User's image

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


    Hope the above answer helps!

    Please let us know do you have any further queries.

    Please do consider to “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Alex Burlachenko 1,025 Reputation points
    2025-02-19T12:16:34.7066667+00:00

    Hey mate,

    Ah, the classic "I want to track stuff but Azure is being stubborn" situation! Yeah, Application Gateway doesn’t log the Referer, and rewrites don’t play nice with redirects (thanks, Stack Overflow, for crushing dreams). Your idea of hosting a web app on domainA is spot on—it’s like putting a bouncer at the door to check IDs (Referer) before letting guests into domainB. It’s the most reliable way to capture that info before the redirect. Plus, it’s a great excuse to build something cool (and billable).

    If you want to avoid the whole web app thing, you could try tagging your URLs with query params (e.g., ?source=stalking-you), but it’s not as fancy.

    Honestly, go with the web app idea—it’s clean, works like a charm, and your clients will probably love it (or at least tolerate it). Let me know how it goes, and good luck convincing them! Cheers! Alex

    1 person found this answer helpful.

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.