7
votes

When using cookie based authentication in CouchDB, the domain appears to be set to the domain of the host; foo.com for example. If we wish to access this session from a subdomain; bar.foo.com for example, this will fail.

From my limited experience with managing cookies, it appears that if you set the domain to .foo.com (notice the leading dot .), then you can access these cookies on subdomains.

Is it possible to change the domain that CouchDB uses when setting the cookie to include the leading dot?

1
After some more digging, the domain isn't actually set to anything, so it defaults to the domain of the host. The question still applies though -- can you set the domain for AuthSession Cookie in couchDB? - irbull
I know that this is a really old issue, it still seems to be unresolved but in 2013 an issue was opened in CouchDB's tracker issues.apache.org/jira/browse/COUCHDB-1959. I'll try to draft a PR for it. - DarĂ­o
Partially same problem, how do you solved it? In my case I got coockie from example.com/mydemo/_session, but it don't work on example.com/mydemo/db/ - Arman Hayots

1 Answers

0
votes

From couch >= 2 ( tested on 2.2 myself ) you can add this to your configuration fille

[couch_httpd_auth] cookie_domain = foo.com