incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin R. Coombes" <>
Subject Re: Proxy missing path component
Date Thu, 28 Oct 2010 14:36:00 GMT
  (Taking this back onto the mailing list.)

 From a pure javascript perspective, yours is clearly the correct 
answer. However, it leads to a difficulty that seems to be inherent in 
couch.js.  Basically, I tried to set the database name using (in 

if (window.location matches /proxyserver...\/couch\//)
     set dbname to couch/myapp
     set dbname to myapp

I then called the CouchDB function (inside couch.js) with the resulting 
dbname.  However, CouchDB assumes that the database name is a single 
component and passes it through encodeURIComponent.  Thus, when my 
script correctly detects that it is coming from the proxy server, the 
dbname get rewritten as
which again leads to a 404 Not Found error.

I suppose I could try forcing an overwrite of the uri element stored in 
Couch DB;  does anyone have a better suggestion?


On 10/27/2010 6:05 PM, Keith Gable wrote:
> On Wed, 2010-10-27 at 17:45 -0500, Kevin R. Coombes wrote:
>> Does anyone have an example that illustrates (using javascript and
>> couch.js) how to figure out which machine originated the call?
>>       Kevin
> I haven't used couch.js, but I assume it runs in the context of the
> browser. So just use window.location and match it against a regex. If it
> matches the one that looks like /^http:\/\/\/couch\// then it's
> external otherwise internal.

View raw message