Repository: couchdb-fauxton Updated Branches: refs/heads/master b671e75a3 -> 4a40e3f9e
Remove Secure from Cookie in dev proxy Remove Secure from the Cookie so that this will work with a CouchDB instance that is using https and a Secure cookie. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/4a40e3f9 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/4a40e3f9 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/4a40e3f9 Branch: refs/heads/master Commit: 4a40e3f9e19f6f53de585a0885ac983ccb111f00 Parents: b671e75 Author: Garren Smith <[email protected]> Authored: Tue Mar 31 10:46:14 2015 +0200 Committer: Garren Smith <[email protected]> Committed: Tue Mar 31 11:09:01 2015 +0200 ---------------------------------------------------------------------- tasks/couchserver.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4a40e3f9/tasks/couchserver.js ---------------------------------------------------------------------- diff --git a/tasks/couchserver.js b/tasks/couchserver.js index d79e556..63784ec 100644 --- a/tasks/couchserver.js +++ b/tasks/couchserver.js @@ -68,7 +68,7 @@ module.exports = function (grunt) { // server js from app directory filePath = path.join(app_dir, url.replace('/_utils/fauxton/', '')); } else if (!!url.match(/ZeroClipboard/)) { - filePath = "./assets/js/plugins/zeroclipboard/ZeroClipboard.swf" + filePath = "./assets/js/plugins/zeroclipboard/ZeroClipboard.swf"; } else if (!!url.match(/testrunner/)) { var testSetup = grunt.util.spawn({cmd: 'grunt', grunt: true, args: ['test_inline']}, function (error, result, code) {/* log.writeln(String(result));*/ }); testSetup.stdout.pipe(process.stdout); @@ -77,7 +77,7 @@ module.exports = function (grunt) { } else if (url === '/' && accept[0] !== 'application/json') { // serve main index file from here filePath = path.join(dist_dir, 'index.html'); - }; + } if (/_utils\/docs/.test(filePath)) { filePath = false; @@ -102,7 +102,8 @@ module.exports = function (grunt) { // This sets the Host header in the proxy so that one can use external // CouchDB instances and not have the Host set to 'localhost' var urlObj = urlLib.parse(req.url); - req.headers['host'] = urlObj.host; + req.headers.host = urlObj.host; + proxy.web(req, res); }).listen(port); @@ -111,6 +112,14 @@ module.exports = function (grunt) { // don't explode on cancelled requests }); + //Remove Secure on the cookie if the proxy is communicating to a CouchDB instance + // via https. + proxy.on('proxyRes', function (proxyRes, req, res) { + if (proxyRes.headers['set-cookie']) { + proxyRes.headers['set-cookie'][0] = proxyRes.headers["set-cookie"][0].replace('Secure', ''); + } + }); + // Fail this task if any errors have been logged if (grunt.errors) { return false;
