I finally found an answer from J. Chris Anderson to someone elses question in 2011:
"You need a rewrite directive that passes through all requests to the database name, to the raw database api. It needs to be the last one in the rewrites.json, and should look like this:" https://github.com/couchbaselabs/pages/blob/master/rewrites.json#L54<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcouchbaselabs%2Fpages%2Fblob%2Fmaster%2Frewrites.json%23L54&sa=D&sntz=1&usg=AFQjCNFP7KwkggHP_4fr4klRJ5mVevACyg> So I added this rule as last to rewrites.json: { "from" : "artendb/*", "to" : "../../*" } And: Yes, views and lists work! I also added { "from": "index.html", "to": "index.html" } for reloading index.html. BUT: This all works IF port 5984 is used. I want people to be able to access the site using http://artdaten.chthough. Not: http://artdaten.ch:5984. Somehow redirecting like this: sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984 doesn't seem to work any more. How can I get things to work with port 80? Alex 2014-03-03 11:58 GMT+01:00 Alexander Gabriel <[email protected]>: > Hi couchers > > Linux- and networking-noob here. > > I'm having a hard time trying to get rewrites to work. > > My goal is this: > User goes to http://artdaten.ch > User gets forwarded to > http://artdaten.ch/artendb/_design/artendb/index.html > or better: index.html opens at http://artdaten.ch/index.html > > What I've done: > > to forward from port 80 to port 5984: > iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984 > > in etc/couchdb/local.ini: > port = 5984 > bind_address = 0.0.0.0 > in [vhost] section: artdaten.ch:5984 = /artendb/_design/artendb/_rewrite > service couchdb restart > > in rewrites.json: > [ > { > "from": "", > "to": "index.html" > } > ] > > This works. Well, sort of: index.html opens at > http://artdaten.ch/index.html. But now lots of paths aren't found, so no > functionality nor stying. > So I added some rules to rewrites.json: > > [ > { > "from": "", > "to": "index.html" > }, > { > "from": "favicon.ico", > "to": "favicon.ico" > }, > { > "from": "style/*", > "to": "style/*" > }, > { > "from": "images/*", > "to": "images/*" > }, > { > "from": "vendor/*", > "to": "vendor/*" > }, > { > "from": "fonts/*", > "to": "fonts/*" > }, > { > "from": "_view/*", > "to": "_view/*" > }, > { > "from": "_list/*", > "to": "_list/*" > }, > { > "from": "_updates/*", > "to": "_updates/*" > } > ] > > The files in style, images, vendor and fonts are now found. But views and > lists aren't. > > Plus pushing the couchapp with the traditional python-tool doesn't work > any more. I have to comment out "artdaten.ch:5984 = > /artendb/_design/artendb/_rewrite" in the vhost section of local.ini to > push, reinstate vhost, then restart couchdb. Very pesky. > > (Plus somehow when changing rewrite rules and local.ini repeatedly I have > managed to be completely refused ssh-access by my virtual server twice > now...) > > Can you help? > > Alex >
