Improved auth

Change-Id: Ib04915ceefb5867f791167b7effbdba109e2d69f
diff --git a/spec/core_proxy.spec.js b/spec/core_proxy.spec.js
index 7afa118..5cd4a70 100644
--- a/spec/core_proxy.spec.js
+++ b/spec/core_proxy.spec.js
@@ -93,7 +93,7 @@
       .end(function(err) {
         if (err) return done(err);
         expect(myStub.set.getCall(0)).to.have.been.calledWith('x-csrftoken', 'testToken');
-        expect(myStub.set.getCall(1)).to.have.been.calledWith('cookie', 'xossessionid=testSession');
+        expect(myStub.set.getCall(1)).to.have.been.calledWith('cookie', 'xoscsrftoken=testToken; xossessionid=testSession');
         done();
       });
     });
diff --git a/src/routes/core_proxy.js b/src/routes/core_proxy.js
index e9cc408..384aa14 100644
--- a/src/routes/core_proxy.js
+++ b/src/routes/core_proxy.js
@@ -30,18 +30,21 @@
       }
 
       // extend with auth info
-      sentReq = sentReq
-        .set('x-csrftoken', req.headers['x-csrftoken'] || null)
-        .set('cookie', `xossessionid=${req.headers['x-sessionid']}` || null)
+      if(req.headers['x-csrftoken'] && req.headers['x-sessionid']){
+        sentReq = sentReq
+          .set('x-csrftoken', req.headers['x-csrftoken'] || null)
+          .set('cookie', `xoscsrftoken=${req.headers['x-csrftoken']}; xossessionid=${req.headers['x-sessionid']}` || null)
+      }
 
       // handle response
       sentReq
         .end((err, r) => {
           if(err) {
-            logger.log('error', err);
+            logger.log('error', sentReq.method, sentReq.url, err);
             return res.status(err.status).send(err.response.error);
           }
-          logger.log('debug', r.status, r.body);
+          logger.log('debug', sentReq.method, sentReq.url, r.status);
+          logger.log('silly', r.text)
           return res.status(r.status).type('json').send(r.body);
         });
     };