Having trouble with my Couchapp rewrites

212 views
Skip to first unread message

Mark Deibert

unread,
Oct 8, 2013, 8:05:52 AM10/8/13
to couc...@googlegroups.com

Ok so now I've added a rewrites.js file to my Couchapp root folder. In this js file I have...

[
   {
       "method": "GET",
       "from": "/home",
       "to": "app/index.html",
   }
]

Now when I push the Couchapp, in CouchDB in my _design/rednecks I see it's creating a "rewrites" property with the above js. So this looks all good to me. This is how to do this right?

I changed my local.ini vhost to...

[vhosts]
rnr.couchdb:5984 = /rednecks/_design/rednecks

In Chrome I enter url...

http://rnr.couchdb:5984/home

I get same error...

{"error":"not_found","reason":"Document is missing attachment"}

That app/index.html attachment is absolutely there. I can see it. The app runs fine if I disable rewrites and use the ugly urls. I've tried every variation of the "to" string that I can think of and all I see is that same error above.

Does anyone know how to do this?!?!?!....


Benoit Chesneau

unread,
Oct 8, 2013, 8:11:54 AM10/8/13
to couc...@googlegroups.com
Is app/index.html in the attachments folder?

Charles Ross

unread,
Oct 8, 2013, 11:39:26 AM10/8/13
to couc...@googlegroups.com
I don't know anything, but I stumbled across this today, maybe similar?

http://stackoverflow.com/questions/18368921/erica-couchdb-rewrites

llabball

unread,
Oct 10, 2013, 9:06:58 AM10/10/13
to couc...@googlegroups.com
Your file structure should look like:

|- _attachments
|- app
|- index.html
|- rewrites.json

llabball

unread,
Oct 10, 2013, 9:08:50 AM10/10/13
to couc...@googlegroups.com
...and the config has to point to the rewrite handler:

[vhosts]
rnr.couchdb:5984 = /rednecks/_design/rednecks/_rewrite

Mark Deibert

unread,
Oct 10, 2013, 5:25:47 PM10/10/13
to couc...@googlegroups.com
@llabball: Actually you're right, changing my vhosts setting to point to _design/rednecks/_rewrites seems to be trying work! Doesn't make any sense to me at all, but whatever! 

Thank you!!!! :-) 

Set my rewrites.json file to this...

[
    { "from": "home", "to": "app/index.html" },
    { "from": "lib/*", "to": "app/lib/*" },
    { "from": "js/*", "to": "app/js/*" },
    { "from": "css/*", "to": "app/css/*" },
    { "from": "img/*", "to": "app/img/*" }
]

It's almost there. It's starting to come together now thanks to your help :-)

Mark Deibert

unread,
Oct 10, 2013, 11:34:51 AM10/10/13
to couc...@googlegroups.com
Set my rewrites.json file to this...

[
{ "from": "home", "to": "app/index.html" },
{ "from": "lib/*", "to": "app/lib/*" },
{ "from": "js/*", "to": "app/js/*" },
{ "from": "css/*", "to": "app/css/*" },
{ "from": "img/*", "to": "app/img/*" }
]

It's almost there. It's starting to come together now thanks to your help :-)



On Thu, Oct 10, 2013 at 11:17 AM, Mark Deibert <mark.d...@gmail.com> wrote:
@llabball: Actually you're right, changing my vhosts setting to point to _design/rednecks/_rewrites seems to be trying work! Doesn't make any sense to me at all, but whatever! I do however see a new issue: the style sheets are not loading. What do I have to add to my rewrites.json to fix this?

Thank you!!!! :-)



On Thu, Oct 10, 2013 at 9:41 AM, Mark Deibert <mark.d...@gmail.com> wrote:
@llabball: I do have the rewrites.json in the Couchapp root. When you push the project to CouchDB, a "rewrites" property is created in the _design/rednecks doc. This property has the content of the rewrites.json file. But your vhosts example above appears to be pointing to some other doc with _id = _design/redecks/_rewrite. What is this other doc for and what is it's content? Couchapp push process doesn't appear to use it, but I could be wrong.

Thanks a lot for your help! I need it :-)




--
You received this message because you are subscribed to the Google Groups "CouchApp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to couchapp+u...@googlegroups.com.
To post to this group, send email to couc...@googlegroups.com.
Visit this group at http://groups.google.com/group/couchapp.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages