Álvaro Valenzuela Valdes commited on
Commit
466f6fd
·
1 Parent(s): dd3ded3

fix: resolve Connection Warning on HF by using relative API paths

Browse files
Files changed (1) hide show
  1. 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
- // The user prefers to centralize all traffic through their personal REWCHILE backend
22
- const backendUrl = `https://rewchile-andesai-backend.hf.space`;
23
-
24
- console.log('[API] Hugging Face Space detected. Frontend:', hostname);
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