couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: Redirects from _list functions in CouchDB 1.4
Date Tue, 17 Sep 2013 14:11:17 GMT
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


Mime
View raw message