You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Amos Hayes <ah...@gcrc.carleton.ca> on 2009/03/11 17:31:06 UTC
Reverse proxy design?
Hello. I've been trying to get couchdb to live happily behind under a
proxied URL like:
http://example.com/couchdb/
And having read through the user list and the instructions at http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy
and experimenting a fair bit, I am still at a loss for how to make
it live happily while deeper than root. Having it proxy to root still
causes problems, at least with futon and in some tests (using curl
seems OK in my very basic queries), and having it nested deeper causes
futon lots of grief. I'm sorry if I'm mixing up couchdb and futon, but
for a new user/admin, they are lumped together.
So I thought I would ask the dev list what (if any) plans are there to
have couchdb and futon live happily in a proxied environment -
particularly one that may be nesting it somewhere other than /. This
seems like a pretty fundamental requirement for something that aims to
play well with web admins, but maybe I'm an oddball. Or maybe you just
haven't gotten there yet. Anyway, since you guys seem to be trying to
lock a few design decisions down before 0.9, I thought I would bring
this up in the hopes that you won't close the door on this sort of use.
Thanks for your time and innovative software!
--
Amos
Re: Reverse proxy design?
Posted by Amos Hayes <ah...@gcrc.carleton.ca>.
Thanks Vicente.
Yesterday, I did go through changing URL strings starting with "/
something" to "../something" in all the client files and was able to
get futon working. Then I started work on the tests and got a bunch of
them running through similar tricks, but there were still a number
failing, as there are with proxying at root.
Then I went and proxied back to "/" instead of "/couchdb" to test what
I had done and futon wasn't happy. At that point I lost patience and
went home.
To be perfectly honest, the number of hard-coded paths and path
prefixes scattered around the client code is really off-putting. Even
after spending an afternoon hunting down variations of what amounts to
"/", and putting code in to do regex on window.location.pathname to
complement CouchDB.host, I still had failing tests and, being new to
all this, no idea of where to go next.
It seems to me that having one spot where you figure out the host and
path prefix and build all the paths everything else needs like "http://example.com/my/couch/db/_all_dbs
" would do wonders for making the couchdb package more flexible and
happy as a piece of web infrastructure.
For those of you that are using couchdb with a site that isn't hosted
from within it, how do you do it now? How do you get couchdb to live
under the same domain:port as your website, while still being able to
administer and run tests? Do you proxy couchdb and then use ssh port
forwarding and test/administer against localhost:5984? That's the only
way I can see both sides of the couch being happy.
Anyway, I really like the ideas you have come up for a web database,
I'm just frustrated. If I work up the nerve again, I will have another
look and see if I can't get it so my changes don't break installs that
*are* at "/". Then I will humbly send in my patches and hope that
someone else can run with getting the remaining tests to be happy.
--
Amos Hayes
Geomatics and Cartographic Research Centre
Carleton University
ahayes@gcrc.carleton.ca
+1.613.520.2600x8179
On 12-Mar-09, at 9:07 AM, Vicente Jiménez wrote:
> Sorry I wanted to meant _all_dbs.
> Reference to ../../_all_dbs instead of /_all_dbs for example.
>
> On Thu, Mar 12, 2009 at 2:04 PM, Vicente Jiménez <go...@gmail.com>
> wrote:
>> I think you just must change all futon interface url from absolute to
>> relative. Using event many .. references like ../../_all_docs.
>>
>> On Wed, Mar 11, 2009 at 7:11 PM, Chris Anderson <jc...@apache.org>
>> wrote:
>>> On Wed, Mar 11, 2009 at 10:57 AM, Amos Hayes <ahayes@gcrc.carleton.ca
>>> > wrote:
>>>>
>>>> OK. Thanks Chris. When you say that almost all tests passed when
>>>> proxied to
>>>> a different domain (still on /), do you think there is something
>>>> wrong with
>>>> how couchdb is operating or is it just that the tests are broken
>>>> in that
>>>> environment? I assume the later if you are talking about test-
>>>> suite tests.
>>>>
>>>
>>> just some little test runner bugs related to the port it's running
>>> on
>>> (and the fact that I redirect '/' elsewhere)
>>>
>>> Yes, you should be able to patch this without touching couchdb
>>> (just JS)
>>>
>>> --
>>> Chris Anderson
>>> http://jchris.mfdz.com
>>>
>>
Re: Reverse proxy design?
Posted by Vicente Jiménez <go...@gmail.com>.
Sorry I wanted to meant _all_dbs.
Reference to ../../_all_dbs instead of /_all_dbs for example.
On Thu, Mar 12, 2009 at 2:04 PM, Vicente Jiménez <go...@gmail.com> wrote:
> I think you just must change all futon interface url from absolute to
> relative. Using event many .. references like ../../_all_docs.
>
> On Wed, Mar 11, 2009 at 7:11 PM, Chris Anderson <jc...@apache.org> wrote:
>> On Wed, Mar 11, 2009 at 10:57 AM, Amos Hayes <ah...@gcrc.carleton.ca> wrote:
>>>
>>> OK. Thanks Chris. When you say that almost all tests passed when proxied to
>>> a different domain (still on /), do you think there is something wrong with
>>> how couchdb is operating or is it just that the tests are broken in that
>>> environment? I assume the later if you are talking about test-suite tests.
>>>
>>
>> just some little test runner bugs related to the port it's running on
>> (and the fact that I redirect '/' elsewhere)
>>
>> Yes, you should be able to patch this without touching couchdb (just JS)
>>
>> --
>> Chris Anderson
>> http://jchris.mfdz.com
>>
>
Re: Reverse proxy design?
Posted by Vicente Jiménez <go...@gmail.com>.
I think you just must change all futon interface url from absolute to
relative. Using event many .. references like ../../_all_docs.
On Wed, Mar 11, 2009 at 7:11 PM, Chris Anderson <jc...@apache.org> wrote:
> On Wed, Mar 11, 2009 at 10:57 AM, Amos Hayes <ah...@gcrc.carleton.ca> wrote:
>>
>> OK. Thanks Chris. When you say that almost all tests passed when proxied to
>> a different domain (still on /), do you think there is something wrong with
>> how couchdb is operating or is it just that the tests are broken in that
>> environment? I assume the later if you are talking about test-suite tests.
>>
>
> just some little test runner bugs related to the port it's running on
> (and the fact that I redirect '/' elsewhere)
>
> Yes, you should be able to patch this without touching couchdb (just JS)
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>
Re: Reverse proxy design?
Posted by Chris Anderson <jc...@apache.org>.
On Wed, Mar 11, 2009 at 10:57 AM, Amos Hayes <ah...@gcrc.carleton.ca> wrote:
>
> OK. Thanks Chris. When you say that almost all tests passed when proxied to
> a different domain (still on /), do you think there is something wrong with
> how couchdb is operating or is it just that the tests are broken in that
> environment? I assume the later if you are talking about test-suite tests.
>
just some little test runner bugs related to the port it's running on
(and the fact that I redirect '/' elsewhere)
Yes, you should be able to patch this without touching couchdb (just JS)
--
Chris Anderson
http://jchris.mfdz.com
Re: Reverse proxy design?
Posted by Amos Hayes <ah...@gcrc.carleton.ca>.
OK. Thanks Chris. When you say that almost all tests passed when
proxied to a different domain (still on /), do you think there is
something wrong with how couchdb is operating or is it just that the
tests are broken in that environment? I assume the later if you are
talking about test-suite tests.
I can't jump into couchdb proper, but I'm willing to have a peek at
the javascript client side.
--
Amos Hayes
Geomatics and Cartographic Research Centre
Carleton University
ahayes@gcrc.carleton.ca
+1.613.520.2600x8179
On 11-Mar-09, at 1:20 PM, Chris Anderson wrote:
> On Wed, Mar 11, 2009 at 9:31 AM, Amos Hayes
> <ah...@gcrc.carleton.ca> wrote:
>>
>> Hello. I've been trying to get couchdb to live happily behind under a
>> proxied URL like:
>>
>> http://example.com/couchdb/
>>
>> And having read through the user list and the instructions at
>> http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy and
>> experimenting a
>> fair bit, I am still at a loss for how to make it live happily
>> while deeper
>> than root. Having it proxy to root still causes problems, at least
>> with
>> futon and in some tests (using curl seems OK in my very basic
>> queries), and
>> having it nested deeper causes futon lots of grief. I'm sorry if
>> I'm mixing
>> up couchdb and futon, but for a new user/admin, they are lumped
>> together.
>
> CouchDB should work just fine behind a properly configured proxy, even
> when stuck into an additional root. I've had success getting my
> proxied CouchDB to pass almost all tests (when proxied to a subdomain,
> not a deeper root.)
>
> CouchDB clients (like Futon and the test-suite client) will likely
> need some patches so they can work in rerooted deployments. My guess
> is that the patches to jquery.couchdb.js to allow a configurable path
> prefix would be fairly localized, and that once that's done, there may
> be a few little patches needed to the rest of Futon. (For instance to
> auto configure the path prefix.)
>
> If you've got a need and the JavaScript chops, I can see a patch for
> this being accepted.
>
> Chris
>
> --
> Chris Anderson
> http://jchris.mfdz.com
Re: Reverse proxy design?
Posted by Chris Anderson <jc...@apache.org>.
On Wed, Mar 11, 2009 at 9:31 AM, Amos Hayes <ah...@gcrc.carleton.ca> wrote:
>
> Hello. I've been trying to get couchdb to live happily behind under a
> proxied URL like:
>
> http://example.com/couchdb/
>
> And having read through the user list and the instructions at
> http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy and experimenting a
> fair bit, I am still at a loss for how to make it live happily while deeper
> than root. Having it proxy to root still causes problems, at least with
> futon and in some tests (using curl seems OK in my very basic queries), and
> having it nested deeper causes futon lots of grief. I'm sorry if I'm mixing
> up couchdb and futon, but for a new user/admin, they are lumped together.
CouchDB should work just fine behind a properly configured proxy, even
when stuck into an additional root. I've had success getting my
proxied CouchDB to pass almost all tests (when proxied to a subdomain,
not a deeper root.)
CouchDB clients (like Futon and the test-suite client) will likely
need some patches so they can work in rerooted deployments. My guess
is that the patches to jquery.couchdb.js to allow a configurable path
prefix would be fairly localized, and that once that's done, there may
be a few little patches needed to the rest of Futon. (For instance to
auto configure the path prefix.)
If you've got a need and the JavaScript chops, I can see a patch for
this being accepted.
Chris
--
Chris Anderson
http://jchris.mfdz.com
Re: Reverse proxy design?
Posted by Sven Helmberger <sv...@gmx.de>.
Amos Hayes wrote:
>
> Hello. I've been trying to get couchdb to live happily behind under a
> proxied URL like:
>
> http://example.com/couchdb/
>
> And having read through the user list and the instructions at
> http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy and
> experimenting a fair bit, I am still at a loss for how to make it live
> happily while deeper than root. Having it proxy to root still causes
> problems, at least with futon and in some tests (using curl seems OK in
> my very basic queries), and having it nested deeper causes futon lots of
> grief. I'm sorry if I'm mixing up couchdb and futon, but for a new
> user/admin, they are lumped together.
>
> So I thought I would ask the dev list what (if any) plans are there to
> have couchdb and futon live happily in a proxied environment -
> particularly one that may be nesting it somewhere other than /. This
> seems like a pretty fundamental requirement for something that aims to
> play well with web admins, but maybe I'm an oddball. Or maybe you just
> haven't gotten there yet. Anyway, since you guys seem to be trying to
> lock a few design decisions down before 0.9, I thought I would bring
> this up in the hopes that you won't close the door on this sort of use.
>
> Thanks for your time and innovative software!
>
> --
> Amos
I had some success with running futon behind a reverse proxy..
My app is basically a java/spring/webmvc based app that uses jcouchdb
for data-storage. set up some mod_rewrite rules in apache for proxying
attachments directly and a rule to forward to a special java proxy
controller that can
a) do access control for the couchdb databases and
b) patch javascripts futon uses to change futon
apache site file http://fforw.de/static/files/markapp
JS File to change futon's behaviour to work behind a "/futon" prefix
http://fforw.de/static/files/jquery-futon-patch.js
Seemed to work fine so far.. wish I had more time to actually work on this..
Regards,
Sven Helmberger