【问题标题】:proxy_read_timeout setting not affecting Nginx (Kong)proxy_read_timeout 设置不影响 Nginx (Kong)
【发布时间】:2017-04-17 14:14:58
【问题描述】:

我们使用 kong 作为我们的 API 网关,并且有一些端点需要超过 60 秒才能响应。根据 Nginx documentation,我可以用proxy_read_timeout 更改此设置,但此设置没有任何影响,我不知道为什么。

我们使用 kong 作为 docker 容器。这是Dockerfile的摘录

FROM mashape/kong:0.9.5
COPY nginx.conf.custom /usr/local/kong/nginx.conf.custom
COPY nginx-kong.conf.custom /usr/local/kong/nginx-kong.conf.custom
...

我们的 nginx-kong.conf.custom 文件除了下面的摘录之外与默认文件相同,在位置 / 块中。

location / {
    set $upstream_host nil;
    set $upstream_url nil;

    access_by_lua_block {
        kong.access()
    }

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $upstream_host;
    proxy_pass_header Server;
    proxy_pass $upstream_url;

    proxy_read_timeout 180s;
    proxy_connect_timeout 75s;

    header_filter_by_lua_block {
        kong.header_filter()
    }

    body_filter_by_lua_block {
        kong.body_filter()
    }

    log_by_lua_block {
        kong.log()
    }
}

【问题讨论】:

    标签: nginx kong


    【解决方案1】:

    这个页面对https://getkong.org/docs/0.10.x/configuration/有帮助吗?或者,如果没有,我们欢迎 PR 来改进文档 - 您可以在此处找到该页面的源代码 https://github.com/Mashape/getkong.org/blob/master/app/docs/0.10.x/configuration.md

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      • 2019-05-04
      • 1970-01-01
      • 2021-02-09
      • 2018-07-04
      • 1970-01-01
      • 2021-10-12
      相关资源
      最近更新 更多