Amir Chatrbahr
Amir Chatrbahr

Reputation: 2360

Logging incoming request referrer in azure

I have deployed few .net APIs and applications as app service to Azure which is being used internally and also some of them can be called externally. Also have set up an Azure Alert for one of the major app services (let's call it Service A) which sends email notification in case of 404 error.

Looking into AppInsights, I can see some requests that result in 404 error when calling one the services without any endpoint included in the url (service B https://serviceB.mydomain.com/) and of course Service B returns 404 however AppInsights doesn't display the request caller (request referer). To investigate the 404 error I need to know about the caller url.

I'm aware that programmatically I can read request referer but how it can be done for 404 error which caused by a request to an endpoint which doesn't exist moreover some requests may not have referer. How can I log the caller url [preferably in Azure app services/appInsights]?

Upvotes: 0

Views: 2126

Answers (2)

Amir Chatrbahr
Amir Chatrbahr

Reputation: 2360

So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.

This link explains how AppInsight configuration can be done in codes to track the Referer.

UPDATE - And the root of issue:

Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here

enter image description here

Upvotes: 1

Jayendran
Jayendran

Reputation: 10940

One of the main reason for this would be that you might configure the availability test in App Insights

To be particularly this will be a URL ping test

This will hit the configured URL frequently at the location you configured

Upvotes: 0

Related Questions