Álvaro Valenzuela Valdes commited on
Commit ·
466f6fd
1
Parent(s): dd3ded3
fix: resolve Connection Warning on HF by using relative API paths
Browse files- frontend/lib/api.ts +4 -6
frontend/lib/api.ts
CHANGED
|
@@ -18,12 +18,10 @@ export function getAPIBase(): string {
|
|
| 18 |
|
| 19 |
// 2. Hugging Face Space detection (IMPROVED)
|
| 20 |
if (hostname.includes('.hf.space')) {
|
| 21 |
-
//
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
console.log('[API] Connecting to Centralized Backend:', backendUrl);
|
| 26 |
-
return backendUrl;
|
| 27 |
}
|
| 28 |
|
| 29 |
// 3. Vercel/Production detection
|
|
|
|
| 18 |
|
| 19 |
// 2. Hugging Face Space detection (IMPROVED)
|
| 20 |
if (hostname.includes('.hf.space')) {
|
| 21 |
+
// On HF Spaces, we use relative paths because we run Nginx as a proxy
|
| 22 |
+
// to both the frontend and backend in the same container.
|
| 23 |
+
console.log('[API] Hugging Face Space detected. Using relative paths.');
|
| 24 |
+
return '';
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
// 3. Vercel/Production detection
|