nginx proxy_pass和couchdb出现问题

nginx proxy_pass和couchdb出现问题,nginx,couchdb,proxypass,Nginx,Couchdb,Proxypass,我想使用nginx在端口80上提供couchdb。我基本上是这样设置nginx conf文件的: upstream couchdb { server 127.0.0.1:5984; } server { listen 0.0.0.0:80; server_name example.com; access_log /path/to/log/couchdb.log; location / { add_header 'Access-Contr

我想使用nginx在端口80上提供couchdb。我基本上是这样设置nginx conf文件的:

upstream couchdb {
    server 127.0.0.1:5984;
}

server {
    listen 0.0.0.0:80;
    server_name example.com;
    access_log /path/to/log/couchdb.log;

    location / {
        add_header 'Access-Control-Allow-Origin' '*';
        proxy_pass http://couchdb;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
}
除了特殊情况外,该配置似乎有效。 当我键入
http://example.com/_utils/
我可以访问couchdb实例,但是如果我键入
http://example.com/_utils
(注意缺少尾随斜杠)由于被重定向到
http://couchdb/_utils
。请注意,
http://example.com:5984/_utils/
http://example.com:5984/_utils
工作正常


我的看法是,问题出在nginx配置上,但我不确定这是怎么回事。

似乎罪魁祸首是
proxy\u重定向关闭。你为什么把它关掉?

谢谢。这是我认为需要的,以便允许一些CORS操作。