Applications Systems
HTTPS monitor returns error code in SAM
Learn how to resolve issue with the HTTPS monitor returning error code 401 or 403
First published date
Last published date
Overview
Product section
Cause
Example:
https://thisisanexamp.le - opens correctly in the browser
HTTPS monitor resolves the IP address of the website and tries to open https://xxx.xxx.xxx.xxx
Which returns:
"Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon."
or:
"403 Forbidden"
or:
"401 Unauthorized"
Resolution
$url=("https://your_url_comes_here")
$wsc=(Invoke-WebRequest -UseBasicParsing -Uri $url).statuscode
try { $response = Invoke-WebRequest $url } catch {
$_.Exception.Response.StatusCode.Value__}
If ( $wsc -ne "200" )
{
Write-Host "Statistic: 1"
Write-Host "Message: $wsc"
exit 1
}
Else
{
Write-Host "Statistic: 0"
Write-Host "Message: $wsc"
exit 0
}