Spaces:
Paused
Paused
Lenson commited on
Commit ·
3bd560b
1
Parent(s): 8c41cd9
fix: force secure cookie on HF Spaces
Browse files
src/routes/dashboard-login.ts
CHANGED
|
@@ -45,6 +45,8 @@ function recordFailure(ip: string): void {
|
|
| 45 |
|
| 46 |
/** Detect HTTPS from X-Forwarded-Proto (reverse proxy) or protocol. */
|
| 47 |
function isHttps(c: Context): boolean {
|
|
|
|
|
|
|
| 48 |
const proto = c.req.header("x-forwarded-proto");
|
| 49 |
if (proto) return proto.toLowerCase() === "https";
|
| 50 |
const url = new URL(c.req.url);
|
|
|
|
| 45 |
|
| 46 |
/** Detect HTTPS from X-Forwarded-Proto (reverse proxy) or protocol. */
|
| 47 |
function isHttps(c: Context): boolean {
|
| 48 |
+
// HF Spaces always uses HTTPS
|
| 49 |
+
if (process.env.HF_SPACE_ID || process.env.SPACES) return true;
|
| 50 |
const proto = c.req.header("x-forwarded-proto");
|
| 51 |
if (proto) return proto.toLowerCase() === "https";
|
| 52 |
const url = new URL(c.req.url);
|