Hi Jake, ugh, yes, I think you’ve hit the nail on the head. In your first configuration, CouchDB is seeing an HTTP-based target and assuming it needs to use the proxy. Your second configuration fails because the replicator does not yet work with local clustered databases.
I think the quickest fix here is to add a check for localhost URLs and not use the proxy for those. Can you file an issue at https://github.com/apache/couchdb/issues ? Thanks, Adam > On Dec 12, 2017, at 11:44 PM, Jake Kroon <jkr...@immersivetechnologies.com> > wrote: > > Hi, > > We are experiencing issues when running CouchDB 2.0.0 behind a proxy, > specifically when trying to perform replication. When performing replication > without a proxy we do not experience any issues. We're attempting to start > the replication by adding a document to the /_replicator/ database, but as > you can see below, it changes to an error state with an "invalid json" error: > > { > "_id": "rep_init", > "_rev": "20-81f3b1999b7f8e9ac51a45e3acbc4432", > "source": > "https://<username>:<password>@dbgateway.<domain>.com/<source_db_name>", > "target": "http://127.0.0.1:5984/<target_db_name>", > "create_target": false, > "continuous": false, > "filter": "replication_filter/no_ddocs", > "owner": null, > "proxy": "http://<proxy_ip_address>:<proxy_port>", > "_replication_state": "error", > "_replication_state_time": "2017-12-07T15:59:12+08:00", > "_replication_state_reason": "{invalid_json,{error,{1,invalid_json}}}", > "_replication_id": "d449aac07eeb8da0e322d4646e0b0f9a" > } > > We suspect what's happening is that CouchDB is attempting to contact the > proxy server for the target database, since the target db name includes the > full address and database name of the local CouchDB server. Since the proxy > server is a remote server and the target database is on the local PC, it > would not be able to access the target address and would return an error HTML > page, rather than the JSON that CouchDB would be expecting. > > Based on this assumption, we attempted to just specify the target db name as > opposed to a URL pointing directly to it, hoping that this would imply that > the target db is in the local database. However, this results in a different > error: > > { > "_id": "rep_init", > "_rev": "43-f0b5d20b601a1e8d9348476133b7b782", > "source": > "https://<username>:<password>@dbgateway.<domain>.com/<source_db_name>,", > "target": "<target_db_name>", > "create_target": false, > "continuous": false, > "proxy": "http://<proxy_ip_address>:<proxy_port>", > "owner": null, > "_replication_state": "error", > "_replication_state_time": "2017-12-07T16:49:39+08:00", > "_replication_state_reason": "{db_not_found,<<\"could not open > <target_db_name>\">>}", > "_replication_id": "85dfa1ffdbbc3a7e346a360e53d7d71f" > } > > Note that the target database does actually exist, so we're not sure why it > would be saying that the db is not found. We've also tried setting > "create_target" to true, but continue to receive the same error. We have > spent a considerable amount of time trying to figure out what we are doing > wrong by reading through the CouchDB documentation. However, we have not as > of yet come to a solution. > > Any support or advice that can be provided would be most appreciated. > > Thank you very much. > > Kind regards, > Jake Kroon > >