A private endpoint may correctly return 401 to an anonymous request. An unexpected 401 on a public page often means an access gate or application rule changed. A standard 401 response must include a WWW-Authenticate challenge. Keep authentication failure separate from permission denial after authentication, and do not include tokens or passwords in shared diagnostic captures.
401 Unauthorized
The resource needs acceptable authentication, and the request has not supplied credentials that satisfy it.
All HTTP status codes
What does HTTP 401 mean?
An investigation example
Illustrative staging-gate investigation
Public homepage returns 401 Unauthorized.
WWW-Authenticate identifies a server-level Basic challenge.
A staging access rule was included in production configuration.
Action: correct the rule's scope.
Verify: public pages load anonymously while staging remains protected.Common causes
- An API token expired, was revoked or belongs to the wrong environment.
- A protected staging site or health endpoint requires credentials the monitor has not supplied.
- A reverse proxy failed to forward the expected authentication header to the application.
Diagnose the response
Inspect the authentication challenge, then check credential validity and whether the client sent them to the intended host.
- Inspect WWW-Authenticate and the endpoint documentation to establish the required scheme. Check token expiry, environment and audience without printing credentials into logs.
- Compare the failing request with one sent by an authenticated client. Verify whether redirects or intermediary rules remove the authorisation header.
- Configure narrowly scoped monitoring credentials where supported, or expose a deliberately limited public health endpoint. Do not make confidential resources public to eliminate an alert.
What it means for website monitoring
Confirm whether the monitored URL is public or intentionally protected. A browser's saved login can hide the authentication requirement seen by a fresh monitoring request.