Application Insights fills with 404 requests nobody sent to the API
Your error
"GET /robots933456.txt HTTP/1.1" 404Fix it fast
Most common cause, 1 of 3Always On calls the root path, and the API has no route there
Add a cheap GET / route that returns 200.
// ASP.NET Core minimal API
app.MapGet("/", () => "OK");
// Express
app.get('/', (req, res) => res.send('OK'));
# or turn Always On off
az webapp config set -g MyResourceGroup -n MyWebapp --always-on falseShort answer
Regular 404s in Application Insights for an Azure App Service API are usually platform pings. Always On sends GET / every five minutes, Health check calls its path every minute, and Linux containers get a /robots933456.txt probe. Add a 200 route at / or a real health path, and ignore the robots probe. Applies to Windows and Linux plans.
Which cause do you have?
In the Application Insights Logs view, group the 404s by path and look at their timing. A path that repeats at a fixed interval with no real user behind it is a platform ping; the path and the interval tell you which one.
AppRequests
| where TimeGenerated > ago(1d) and ResultCode == "404"
| summarize hits = count(), first = min(TimeGenerated), last = max(TimeGenerated) by Name, Url
| order by hits descThen find the line you see in this list and open its fix:
- 1Always On calls the root path, and the API has no route there
The failing request is GET / and it repeats about every five minutes, also at night - 2Health check points at a path the app does not have
The 404 path is the one set under Monitoring > Health check, it repeats every minute, and instances drop out of rotation or get replaced - 3The Linux container start probe for /robots933456.txt
The path is /robots933456.txt and the entries appear around restarts, deployments or scale-out
What does the error look like?
"GET /robots933456.txt HTTP/1.1" 404
Cause 1 of 3
Always On calls the root path, and the API has no route there
You seeThe failing request is GET / and it repeats about every five minutes, also at night
Check
Steady 404s for GET / on an App Service API come from Always On when nothing in the app answers the root URL. With Always On turned on, the front-end load balancer sends a GET request to the application root every five minutes to keep the app loaded, and an API that only maps /api/... routes replies 404 to each one.
az webapp config show --name MyWebapp --resource-group MyResourceGroup | grep -i alwaysonFix
Add a cheap GET / route that returns 200. If the app does not need to stay warm and runs no continuous or scheduled WebJobs, you can turn Always On off instead, at the cost of a slow first request after 20 idle minutes.
// ASP.NET Core minimal API
app.MapGet("/", () => "OK");
// Express
app.get('/', (req, res) => res.send('OK'));
# or turn Always On off
az webapp config set -g MyResourceGroup -n MyWebapp --always-on falseVerify
After the next deployment the five-minute GET / entries show result code 200.
AppRequests
| where TimeGenerated > ago(1h) and Url endswith "/"
| summarize count() by ResultCodeConfirmed by learn.microsoft.com
Cause 2 of 3
Health check points at a path the app does not have
You seeThe 404 path is the one set under Monitoring > Health check, it repeats every minute, and instances drop out of rotation or get replaced
Check
When the Health check path is a route the app does not serve, every probe returns 404. App Service has no default path: it pings the one you entered on every instance at one-minute intervals, and an instance that keeps answering outside 200-299 is taken out of the load balancer and later replaced. The 404s are then a real outage risk, not only noise.
AppRequests
| where TimeGenerated > ago(1h) and ResultCode == "404"
| summarize count() by Name, bin(TimeGenerated, 1m)Fix
Create the endpoint at the configured path, or change the setting to a path that exists. It should return 200 only once the app is warmed up and can reach its critical dependencies, and it must allow anonymous access if the app uses its own authentication.
// ASP.NET Core minimal API
app.MapGet("/api/health", () => "Healthy");
// Express
app.get('/api/health', (req, res) => res.send('Healthy'));Verify
The Health check page shows the instances as healthy and the one-minute 404s stop.
curl -i https://myapp.azurewebsites.net/api/healthConfirmed by learn.microsoft.com
Cause 3 of 3
The Linux container start probe for /robots933456.txt
You seeThe path is /robots933456.txt and the entries appear around restarts, deployments or scale-out
Check
A 404 for /robots933456.txt on a Linux App Service is expected. Microsoft documents it as a dummy path App Service requests to see whether the container can serve HTTP; the 404 itself tells App Service the container is up and ready.
AppRequests
| where TimeGenerated > ago(7d) and Url has "robots933456"
| summarize count() by bin(TimeGenerated, 1h)Fix
Do not add a route for it. Leave the path out of failed-request alerts and dashboards so real 404s stay visible.
AppRequests
| where ResultCode == "404" and Url !has "robots933456"Verify
Your 404 alert no longer fires after a restart, while a test request to a wrong URL still shows up.
curl -i https://myapp.azurewebsites.net/does-not-existConfirmed by learn.microsoft.com
How do I stop it coming back?
- Give every App Service API a GET / route and a separate health route from the first deployment, and test both in CI with curl.
- Write failed-request alerts on AppRequests that exclude the known probe paths instead of alerting on the raw 404 count.
- Record the Always On and Health check settings in your infrastructure code so a portal change does not silently start new pings.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Raheeb.