diff options
author | Russell Branca <chewbranca@gmail.com> | 2013-04-25 12:57:49 -0700 |
---|---|---|
committer | Russell Branca <chewbranca@gmail.com> | 2013-04-25 12:58:05 -0700 |
commit | 86cda7b37f5d2a8d5cd2a2022333c06d71ffb4de (patch) | |
tree | 2b4ce0680ad6a4d79e8b4bec2b76151f15bf0622 | |
parent | a0fc1c608d9f05b68cd05ebb35b842c9ad5c82cc (diff) | |
download | couchdb-86cda7b37f5d2a8d5cd2a2022333c06d71ffb4de.tar.gz |
Allow external CouchDB servers for Fauxton proxy
-rw-r--r-- | src/fauxton/Gruntfile.js | 11 | ||||
-rw-r--r-- | src/fauxton/tasks/couchserver.js | 16 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js index 814279ae5..b76ae24e8 100644 --- a/src/fauxton/Gruntfile.js +++ b/src/fauxton/Gruntfile.js @@ -194,9 +194,14 @@ module.exports = function(grunt) { dist: './dist/debug/', port: 8000, proxy: { - host: 'localhost', - port: 5984, - https: false + target: { + host: 'localhost', + port: 5984, + https: false + }, + // This sets the Host header in the proxy so that you can use external + // CouchDB instances and not have the Host set to 'localhost' + changeOrigin: true } }, diff --git a/src/fauxton/tasks/couchserver.js b/src/fauxton/tasks/couchserver.js index a3f620ffc..576893b29 100644 --- a/src/fauxton/tasks/couchserver.js +++ b/src/fauxton/tasks/couchserver.js @@ -26,11 +26,13 @@ module.exports = function (grunt) { var port = options.port || 8000; // Proxy options with default localhost - var proxy_target = options.proxy || { - host: 'localhost', - port: 5984, - https: false - }; + var proxy_settings = options.proxy || { + target: { + host: 'localhost', + port: 5984, + https: false + } + }; // inform grunt that this task is async var done = this.async(); @@ -46,9 +48,7 @@ module.exports = function (grunt) { }); // create proxy to couch for all couch requests - var proxy = new httpProxy.HttpProxy({ - target: proxy_target - }); + var proxy = new httpProxy.HttpProxy(proxy_settings); app.all('*', function (req, res) { proxy.proxyRequest(req, res); |