incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Gschwantner <bernh...@unserwein.at>
Subject Re: Redirects from _list functions in CouchDB 1.4
Date Tue, 17 Sep 2013 15:27:13 GMT
Hi Bob,

that doesn't seem to solve the problem. Even when I put the code from the
wiki (first example) into a fresh design doc, I get the badmatch error in
the couchdb _logs.

Bernhard


2013/9/17 Robert Newson <rnewson@apache.org>

> Comparing with the examples at
> https://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Sending_a_Redirect,
> I think you need to return JSON (which requires the double quotes for
> "code", for example) rather than Javascript.
>
> B.
>
> On 17 Sep 2013, at 14:34, Bernhard Gschwantner <bernhard@unserwein.at>
> wrote:
>
> > Hello,
> >
> > I tried to redirect from a _list function without success. This code
> throws
> > a badarg error in CouchDB 1.4.0 (also in 1.2 and 1.3):
> >
> > function(head, req) {
> >  return {
> >    code : 301,
> >    headers : {
> >      Location : 'http://www.google.com'
> >    }
> >  };
> > }
> >
> > Is there something I am doing wrong or missing?
> >
> > The real-world use case is that we have several aliases to each document
> in
> > the db, and all those aliases should be redirected to the real document
> id.
> > We use a view to emit the aliases and a list function to redirect all
> those
> > aliases to the real url.
> >
> > We've been working around the previous issues with modifying headers
> after
> > getRow() by redirecting through JavaScript, but want to get rid of this
> > workaround eventually.
> >
> > Regards,
> > Bernhard
> >
> > --
> >
> > Bernhard Gschwantner
> > Unser Wein G&U OG
> > Kirchengasse 13/7, 1070 Wien
> >
> > mobil: +43 (6991) 971 32 96
> > tel: +43 (1) 971 32 95
> > e-mail: bernhard@unserwein.at
> > twitter: @bernharduw <http://twitter.com/bernharduw>
> > web: www.unserwein.at
>
>


-- 

Bernhard Gschwantner
Unser Wein G&U OG
Kirchengasse 13/7, 1070 Wien

mobil: +43 (6991) 971 32 96
tel: +43 (1) 971 32 95
e-mail: bernhard@unserwein.at
twitter: @bernharduw <http://twitter.com/bernharduw>
web: www.unserwein.at

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message