Monitoring pages behind Basic Authentication
HTTP Basic Authentication restricts website access by asking visitors to enter a username and password. This article explains how to support this in a monitoring environment.
You can either send an Authorization
header with each request or include the user credentials in the URL.
Setting the Authorization header with the Basic Auth setting
- Open your page settings
- Click Show Advanced
- Expand the Basic Auth section
- Click Add Basic Auth
- Click Create or select an existing configuration
- Enter a name for the setting, plus username and password
Finally, click Create and the setting will be added to your page.
Passing credentials in the URL
You can also inlucude credentials directly in the website URL.
Suppose you want to monitor http://example.com
, with the username sam
and password hunter2
. You'll be able to access the site if you use this URL: http://sam:hunter2@example.com
Error if Basic Auth credentials are not provided
If credentials are not provided to a website that uses Basic Auth you'll see a net::ERR_INVALID_AUTH_CREDENTIALS
error. Pass the correct username and password, either in the URL or via the Authorization
header.