fix: Recognize 301/401/403 as reachable in embedding health check
Remote APIs like Cloudflare Workers AI return 401 on /health and 301 on HEAD requests. These indicate the server IS reachable, not down. Previously only 404/405 were treated as reachable, causing all KB indexing to fail with 'Embedding server not available'.
This commit is contained in:
parent
a923ab2db1
commit
248165c3cb
1 changed files with 25 additions and 19 deletions
|
|
@ -341,6 +341,12 @@ impl KbEmbeddingGenerator {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if status.is_redirection() || status.as_u16() == 401 || status.as_u16() == 403 {
|
||||||
|
// Redirect (301/302) or auth-required (401/403) means the server IS reachable
|
||||||
|
// This is typical for remote APIs like Cloudflare Workers AI
|
||||||
|
info!("Embedding server reachable at {} (status {} indicates external API), marking as ready", base_url, status);
|
||||||
|
set_embedding_server_ready(true);
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
warn!("Embedding server health check returned status {}", status);
|
warn!("Embedding server health check returned status {}", status);
|
||||||
set_embedding_server_ready(false);
|
set_embedding_server_ready(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue