[ 
https://issues.apache.org/jira/browse/COUCHDB-1005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976590#action_12976590
 ] 

Sam Bisbee commented on COUCHDB-1005:
-------------------------------------

I have a virtual host that masks the database name and sends all requests to 
the rewriter (host:5984 -> /plugins/_design/app/_rewrite). I'm using rewrite 
because the files I'm storing data on, and the files themselves, are being 
served in a non-REST conforming scheme. I have to do some string manipulation 
to bridge that gap, and don't see a reason to bolt on an additional app layer 
or putting app logic into my httpd/proxy. Especially when this seems to be a 
clear cut use case of the rewrite system.

Thanks for taking a look at this!

----

"rewrites": [
       {
           "from": "/:user/:plugin",
           "to": "../../:user%2f:plugin/"
       }
   ]

then I request /cowboy/bbq

'GET' /plugins/undefined?user=cowboy&plugin=bbq 404

----

"rewrites": [
       {
           "from": "/:user/:plugin",
           "to": "../../:user/:plugin/"
       }
   ]

then I request /cowboy/bbq

'GET' /plugins/cowboy/bbq?user=cowboy&plugin=bbq 404

(The embedded slash is needed, but as seen in the previous example, embedded 
slashes the same "that's not a slash" issue.)

----

"rewrites": [
       {
           "from": "/:user/:plugin",
           "to": "../../:user-:plugin/"
       }
   ]

then I request /cowboy/bbq

'GET' /plugins/undefined?user=cowboy&plugin=bbq 404

> Rewriting to a URL with 2 replacements fails
> --------------------------------------------
>
>                 Key: COUCHDB-1005
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1005
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>            Reporter: Sam Bisbee
>
> When I pull two variables out of a URL and drop them into the target, the 
> target URL breaks. However, it appears that the variables are being captured 
> appropriately.
> This couch was built from source on Ubuntu 10.04 and is running a default 
> config.
> Unexpected Results
> ----------------------------
> Assuming that we're querying the _rewrite handler with /foo/bar
> { "from": "/:user/:plugin", "to": "../../:user-:plugin"} will result in 
> /db/undefined?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user :plugin"} will result in 
> /db/undefined?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user"} will CORRECTLY result in 
> /db/foo?user=foo&plugin=bar
> Expected Results
> ------------------------
> { "from": "/:user/:plugin", "to": "../../:user-:plugin"} should result in 
> /db/foo-bar?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user :plugin"} will result in 
> /db/foo bar?user=foo&plugin=bar

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to