Lenson commited on
Commit
8c41cd9
·
1 Parent(s): 15ac309

fix: bypass dashboard auth on HF Spaces

Browse files
Files changed (1) hide show
  1. src/middleware/dashboard-auth.ts +3 -0
src/middleware/dashboard-auth.ts CHANGED
@@ -30,6 +30,9 @@ export async function dashboardAuth(c: Context, next: Next): Promise<Response |
30
  // No key configured → no gate
31
  if (!config.server.proxy_api_key) return next();
32
 
 
 
 
33
  // Localhost → bypass (Electron + local dev)
34
  const remoteAddr = getConnInfo(c).remote.address ?? "";
35
  if (isLocalhostRequest(remoteAddr)) return next();
 
30
  // No key configured → no gate
31
  if (!config.server.proxy_api_key) return next();
32
 
33
+ // HF Spaces → bypass (reverse proxy makes localhost detection unreliable)
34
+ if (process.env.HF_SPACE_ID || process.env.SPACES) return next();
35
+
36
  // Localhost → bypass (Electron + local dev)
37
  const remoteAddr = getConnInfo(c).remote.address ?? "";
38
  if (isLocalhostRequest(remoteAddr)) return next();