Surface 401 from instance detection so the user can supply credentials

When an instance sits behind a reverse proxy that requires HTTP Basic Auth,
every detection probe (/info, /api/v1/config, /api/v1/stats, /healthcheck,
/config) returns 401 before reaching the real backend, so the type cannot be
identified. Re-throw APIError.unauthorized from each probe instead of
swallowing it, and have detectWithResult convert the first 401 it sees into
DetectionError.basicAuthRequired. Add a basicAuthHeader parameter so the
caller can retry detection after the user provides credentials; if a retry
also returns 401, surface basicAuthInvalid instead.
This commit is contained in:
Arkadiusz Fal
2026-04-06 19:56:34 +02:00
parent 63f1cb1f25
commit 222b53d520
2 changed files with 102 additions and 29 deletions

View File

@@ -14593,6 +14593,28 @@
}
}
},
"sources.error.basicAuthInvalid" : {
"comment" : "Error when HTTP Basic Auth credentials are rejected by the server",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Invalid HTTP Basic Auth credentials. Check the username and password."
}
}
}
},
"sources.error.basicAuthRequired" : {
"comment" : "Error when an instance is fronted by HTTP Basic Auth and credentials are required to detect its type",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This instance requires HTTP Basic Auth. Enter a username and password to continue."
}
}
}
},
"sources.error.couldNotDetect" : {
"comment" : "Error when source type could not be detected",
"localizations" : {