Skip to content

Commit ca02c26

Browse files
handle redirects in host reachability test (#19196)
1 parent 0e7fae6 commit ca02c26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/server/src/auth/auth-provider-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,9 @@ export class AuthProviderService {
415415

416416
async isHostReachable(host: string): Promise<boolean> {
417417
try {
418-
const resp = await fetch(`https://${host}`, { timeout: 2000 });
419-
return resp.ok;
418+
// Don't attempt to follow redirects, and manually check response status code
419+
const resp = await fetch(`https://${host}`, { timeout: 2000, redirect: "manual" });
420+
return resp.status <= 399;
420421
} catch (error) {
421422
console.log(`Host is not reachable: ${host}`);
422423
}

0 commit comments

Comments
 (0)