diff --git a/apiProxyMiddleware.js b/apiProxyMiddleware.js index 00cdd517..47c5752a 100644 --- a/apiProxyMiddleware.js +++ b/apiProxyMiddleware.js @@ -4,18 +4,18 @@ function apiProxyMiddleware (req, res, next) { if (!(req.xhr || req.originalUrl.indexOf('.json') > -1 || req.method !== 'GET')) { return next() } - console.log('xhr request', req.originalUrl) const method = req.method.toLowerCase() req.pipe( request[method](process.env.API + req.originalUrl, { headers: { ...req.headers, - host: process.env.API + cookie: `_Metamaps_session=${req.cookies._Metamaps_session}`, + host: 'localhost:3001' }, followRedirect: false }) ) - .on('error', console.log) + .on('error', (err) => console.log(err)) .pipe(res) } diff --git a/package-lock.json b/package-lock.json index 3c7867bc..527b727e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,9 +67,7 @@ } }, "action-cable-node": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/action-cable-node/-/action-cable-node-1.2.2.tgz", - "integrity": "sha1-KwXl/iR+qqRXfwct2lDOCiEYOS0=" + "version": "github:Connoropolous/action-cable-node#346d691343251b4148ccc0607f87728d4d97f2cd" }, "after": { "version": "0.8.1", @@ -1909,7 +1907,7 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=", "dev": true }, "content-type-parser": { @@ -1926,14 +1924,21 @@ "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", - "dev": true + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-parser": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.3.tgz", + "integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=", + "requires": { + "cookie": "0.3.1", + "cookie-signature": "1.0.6" + } }, "cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", - "dev": true + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, "copy-descriptor": { "version": "0.1.1", @@ -5479,6 +5484,11 @@ "jquery": "3.2.1" } }, + "js-cookie": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.0.tgz", + "integrity": "sha1-Gywnmm7s44ChIWi5JIUmWzWx7/s=" + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -6297,7 +6307,7 @@ "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", + "integrity": "sha1-Eh+evEnjdm8xGnbh+hyAA8SwOqY=", "dev": true }, "mime-db": { @@ -8276,7 +8286,7 @@ "send": { "version": "0.16.1", "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", - "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", + "integrity": "sha1-pw4coh0TgsEdDZ9iMd6ygQgNerM=", "dev": true, "requires": { "debug": "2.6.9", @@ -8320,7 +8330,7 @@ "serve-static": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", - "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", + "integrity": "sha1-TFfVNASnYdjy58HooYpH2/J4pxk=", "dev": true, "requires": { "encodeurl": "1.0.2", @@ -8368,7 +8378,7 @@ "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "integrity": "sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY=", "dev": true }, "sha.js": { diff --git a/package.json b/package.json index 6300145d..fffa5608 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "backbone": "1.3.3", "clipboard-js": "0.3.5", "commonmark": "0.28.1", + "cookie-parser": "^1.4.3", "csv-parse": "1.2.1", "emoji-mart": "1.0.1", "getscreenmedia": "4.0.1", diff --git a/public/index.html b/public/index.html index 50ff301d..a0b79386 100644 --- a/public/index.html +++ b/public/index.html @@ -64,8 +64,7 @@ - -
+