Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How should I use replication with databases behind reverse proxy #5135

Unanswered
kishieel asked this question in Q&A
Discussion options

I have two CouchDB instances behind reverse proxies. They can be accessed with following urls.

DB1: https://example-1.com/_db
DB2: https://example-2.com/_db

Notice: _db is not the name of database, but it is the root path for CouchDB instance, so when I call https://example-1.com/_db I am getting:

{"couchdb":"Welcome","version":"3.3.3", ...}

Now I am trying to replicate data from DB1 to DB2. I created following document in DB1:

{
 "_id": "replication_test",
 "source_proxy": "https://username:password@domain-1.com/_db",
 "target_proxy": "https://username:password@domain-2.com/_db",
 "source": "https://username:password@domain-1.com/_db/test-database",
 "target": "https://username:password@domain-2.com/_db/test-database",
 "create_target": true
}

But it always ends with an error:

[error] 2024年07月16日T14:43:18.491719Z couchdb@127.0.0.1 <0.14885.0> -------- error:function_clause: Replication 3770eba19a8e88abe8ad9ba323b2833a failed to start "https://example-1.com/_db/test-database/" -> "https://example-1.com/_db/test-database/" doc null:null stack:[{couch_replicator_auth_session,http_response,[connection_closed_no_retry,{state,0,undefined,"username","password",30000,<0.14909.0>,[{is_ssl,true},{proxy_host,"domain-1.com"},{proxy_password,"password"},{proxy_port,443},{proxy_user,"username"},{socket_options,[{keepalive,true},{nodelay,false}]},{ssl_options,[{depth,3},{verify,verify_none}]}],"https://domain-1.com/_session",infinity,0,false}],[{file,"src/couch_replicator_auth_session.erl"},{line,371}]},{couch_replicator_auth_session,init_state,1,[{file,"src/couch_replicator_auth_session.erl"},{line,188}]}]

Assuming from error log CouchDB is sending request to https://domain-1.com/_session which cannot work as this endpoint does not exist in this setup. It should be https://domain-1.com/_db/_session.

I tried also without source_proxy and target_proxy but in this case I am getting

{"error":"replication_auth_error","reason":"{session_request_forbidden,\"https://domain-1.com/_session\",\n \"username\"}"}

Which also shows that the request is not being sent to correct destination.

Am I using proxy options wrong? Or replication in CouchDB is not able to work when the database is not exposed from the root path?

You must be logged in to vote

Replies: 1 comment

Comment options

CouchDB is not relocatable in that way, you'll need to configure your proxy to rewrite the paths to match the couchdb api (/$dbname, etc).

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /