You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Yves Serrano <y...@yas.ch> on 2011/05/27 02:08:45 UTC

vhost rewrite and httpd_global_handlers

hi

I'm new to couchdb and it makes fun to play with it :-).
I using vhost and rewrites to get nice urls. I also have defined some static html via
...
[httpd_global_handlers]
static = {couch_httpd_misc_handlers, handle_utils_dir_req, "/path/to/static"}
...

My problem is that I can't get access to http://127.0.0.1:5984/static from my vhost http://couchdb.local/static. 
I get into a 301 redirect loop, which stops after to much recursion. 

I tried this rewrite rule:
{
    "from": "/static/*",
    "to": "../../../static/*"
},

// my vhost setup
[vhosts]
cochdb.local:5984 = /mydb/_design/mydb/_rewrite/

I needed to set secure_rewrites to false, otherwise I get the error: "insecure_rewrite_rule". Is there a better way?

I'm using couchdb 1.0.2. I want to archive this without any other http server like apache to keep it simple.
What I'm doing wrong? Is this possible with couchdb 1.0.2? If not, will it be possible with couchdb 1.1.0? 

regards
yves


Re: vhost rewrite and httpd_global_handlers

Posted by Benoit Chesneau <bc...@gmail.com>.
On Fri, May 27, 2011 at 2:08 AM, Yves Serrano <y...@yas.ch> wrote:
> hi
>
> I'm new to couchdb and it makes fun to play with it :-).
> I using vhost and rewrites to get nice urls. I also have defined some static html via
> ...
> [httpd_global_handlers]
> static = {couch_httpd_misc_handlers, handle_utils_dir_req, "/path/to/static"}
> ...
>
> My problem is that I can't get access to http://127.0.0.1:5984/static from my vhost http://couchdb.local/static.
> I get into a 301 redirect loop, which stops after to much recursion.
>
> I tried this rewrite rule:
> {
>    "from": "/static/*",
>    "to": "../../../static/*"
> },
>
> // my vhost setup
> [vhosts]
> cochdb.local:5984 = /mydb/_design/mydb/_rewrite/
>
> I needed to set secure_rewrites to false, otherwise I get the error: "insecure_rewrite_rule". Is there a better way?
>
> I'm using couchdb 1.0.2. I want to archive this without any other http server like apache to keep it simple.
> What I'm doing wrong? Is this possible with couchdb 1.0.2? If not, will it be possible with couchdb 1.1.0?
>
> regards
> yves
>
>
Use _static instead of static for the name and put _static in
vhost_global_handlers then you should be abble to access it at
cochdb.local:5984/_static .

- benoît