incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: Strange issue with VHosts and rewrites...
Date Thu, 13 Jan 2011 07:21:58 GMT
did you try to add:

{

"from": ":db",
"to": "../.."
}

?

- benoît

On Mon, Jan 10, 2011 at 6:21 PM, Janez Štupar <janez.stupar@gmail.com> wrote:
> Here is the problem I'm currently dabbling around with Sofa (got it from
> jchrisa's Github)... To this end I'm reverse engineering it and trying to
> get it work in a following scenario:
>
> The database is hidden behind following VHost: sofa.mycouch  ->
> /sofa/_design/sofa/_rewrite
>
> Since I wanted to improve the appearance of the URL's I also did some
> modifications to the rewrites, my current configuration is as follows:
>
> [
>   {
>       "to": "_list/index/recent-posts",
>       "from": "blog/",
>       "query": {
>           "limit": 10,
>           "descending": true
>       }
>   },
>   {
>       "to": "_list/:listname/*",
>       "from": "list/:listname/*",
>       "query": {
>           "limit": 10,
>           "descending": true
>       }
>   },
>   {
>        "to" : "_show/:showname/*",
>        "from" : "show/:showname/*"
>   },
>   {
>         "to" : "_update/:updatename/*",
>         "from" : "update/:updatename/*"
>   },
>   {
>       "to": "_list/index/recent-posts",
>       "from": "",
>       "query": {
>           "limit": 10,
>           "descending": true
>       }
>   },
>   {
>       "to": "script/*",
>       "from": "script/*"
>   },
>   {
>       "to": "style/*",
>       "from": "style/*"
>   },
>   {
>       "to": "vendor/*",
>       "from": "vendor/*"
>   },
>   {
>    "to": "../../*",
>    "from": ":db/*"
>   }
> ]
>
> The last problem I have left is that although everything works (I have
> indeed done some modifications to the templates, pathing function, etc..
> nothing relevant to this current issue IMHO).
> *
> Except* one thing doesn't work as expected ... that is posting comments. I
> have kinda narrowed it down that when the browser sends a new blog post it
> does PUT to address: '"/sofa/_design/sofa/_rewrite/sofa/spet-nov-post"'
> (spet-nov-post is a _id - according to jquery.couch.js)
>
> While comment gets POST -ed to following URL:
> '"/sofa/_design/sofa/_rewrite/sofa/"'
>
> what happens in the rewriter is following:
>
> 'PUT' /sofa/_design/sofa/_rewrite/sofa/spet-nov-post {1,1} -> 'PUT'
> /sofa/spet-nov-post?db=sofa {1,1}
> 'POST' /sofa/_design/sofa/_rewrite/sofa/ {1,1}  -> 'POST'
> /sofa/_design/..?db=sofa {1,1}
>
> I blame the following rewrite rule:
>   {
>    "to": "../../*",
>    "from": ":db/*"
>   }
>

Mime
View raw message