Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix

Marc Seitz078d47c7f74e
diff --git a/pages/api/links/download/[jobId].ts b/pages/api/links/download/[jobId].ts
index 40d2673d..c5915815 100644
--- a/pages/api/links/download/[jobId].ts
+++ b/pages/api/links/download/[jobId].ts
@@ -47,7 +47,11 @@ export default async function handler(
}
// Use the request's origin so download links work on custom domains
- const proto = req.headers["x-forwarded-proto"] || "https";
+ const rawProto = req.headers["x-forwarded-proto"];
+ const proto =
+ (Array.isArray(rawProto)
+ ? rawProto[0]
+ : rawProto?.split(",")[0]?.trim()) || "https";
const host = req.headers["host"] || "app.papermark.com";
const baseUrl = `${proto}://${host}`;