【问题标题】:Issue with nginx proxy_pass and couchdbnginx proxy_pass 和 couchdb 的问题
【发布时间】:2012-07-11 03:46:34
【问题描述】:

我想使用 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 都可以正常工作。

我的 WAG 是 nginx 配置的问题,但我不确定是怎么回事。

【问题讨论】:

    标签: nginx couchdb proxypass


    【解决方案1】:

    看来罪魁祸首是proxy_redirect off;。你为什么关掉它?

    【讨论】:

    • 谢谢。这是我认为允许某些 CORS 操作所必需的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2015-04-08
    • 2013-06-27
    • 1970-01-01
    相关资源
    最近更新 更多