I wanted to map my custom domain to a design document _rewrite.
// Configuration
vho开发者_如何学JAVAsts www.myapp.com /myapp/_design/user/_rewrite
// Rewrites
[{
"from": "",
"to": "static/browser/index.html"
}, {
"from": "*",
"to": "*"
}]
The first route works fine. I can access the index.html with www.myapp.com. However, now I can't access www.myapp.com/_utils. It says _all_dbs can't be found in the browser console. All other APIs stop working as well.
I guess this is because that path is now converted to /myapp/_design/user/_utils.
How can I fix this?
_utils
and other "special" paths do not cooperate with vhosts very well. Last I checked (version 1.0.2 I think), _utils will display the Futon UI however its AJAX calls to _all_dbs
and others will fail and it is a total mess.
I suggest a strict separation between your app and your internal management. Use the vhost for the application, but always avoid vhosts when accessing Futon or other tools.
There are a few tricks to avoid your vhost.
- Use the server IP address instead of the domain name:
http://1.2.3.4:5984
- Use a different port if possible:
http://www.myapp.com:5984
orhttps://www.myapp.com:6984
- Add an alternative DNS entry pointing to the same couch and use that:
http://futon.myapp.com
- Add a dot at the end of your domain.
http://www.myapp.com./
— This is very sneaky (or clever). That is a valid DNS name however CouchDB treats it differently fromwww.myapp.com
therefore you will not trigger the vhost.
Did you check the couchdb ini file (/etc/couchdb/local.ini), the bind parameter.
精彩评论