proxy_pass を使用して、私のドメインで実行されている NGINX を介して、Cloudant の couchdb 機能の一部を公開したいと考えています。これまでのところ、いくつかの問題を解決してきましたが (以下に記載)、承認に関しては行き詰まっています。誰にもヒントはありますか?
location /couchdb {
rewrite /couchdb/(.*) /$1 break; #chop off start of this url
proxy_redirect off
proxy_buffering off;
proxy_set_header Host myusername.cloudant.com;
# cannot use $host! must specify my vhost on cloudant
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Authorization "Basic base64-encode(username:password)";
proxy_pass http://myusername.cloudant.com$request_uri;
# must use a variable in this url so that the domain is looked up late.
# otherwise nginx will fail to start about half the time because of resolver issues
# (unknown why though)
}
このセットアップを使用すると、Cloudant に正常にプロキシできますが、常に禁止された応答を受け取ります。たとえば、次のリクエスト:
http://mydomain/couchdb/my-cloudant-db
戻り値
{"error":"forbidden", "reason":"_reader access is required for this request"}
助けてくれてありがとう。