From 15281ad8337961a8bb0d72b5ef4482016c1c6952 Mon Sep 17 00:00:00 2001
From: Andrey Platov <andrey@hardcoreeng.com>
Date: Wed, 10 Nov 2021 18:39:32 +0100
Subject: [PATCH] add cookies support for front import

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
---
 server/front/src/app.ts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/front/src/app.ts b/server/front/src/app.ts
index 4498eade68..a891be79b3 100644
--- a/server/front/src/app.ts
+++ b/server/front/src/app.ts
@@ -192,10 +192,19 @@ export function start (transactorEndpoint: string, elasticUrl: string, minio: Cl
     const token = authHeader.split(' ')[1]
     const payload = decode(token ?? '', 'secret', false) as Token
     const url = req.query.url as string
+    const cookie = req.query.cookie as string | undefined
 
     console.log('importing from ', url)
 
-    https.get(url, response => {
+    const options = cookie !== undefined
+      ? {
+          headers: {
+            Cookie: cookie
+          }
+        }
+      : {}
+
+    https.get(url, options, response => {
       console.log('status', response.statusCode)
       const id = uuid()
       const contentType = response.headers['content-type']