【发布时间】:2018-05-07 07:44:54
【问题描述】:
我们正在使用 nginx 在 AWS presto 集群前面提供一个安全层。我们为 nginx-presto-cluster.our-domain.com 注册了一个 SSL 证书
presto 的请求通过具有基本身份验证的 nginx 传递。 presto 的 SQL 查询导致向服务器发出多个顺序请求,以获取查询结果。
我们创建了一个如下所示的 nginx.conf:
location / {
auth_basic $auth;
auth_basic_user_file /etc/nginx/.htpasswd;
sub_filter_types *;
sub_filter_once off;
sub_filter 'http://localhost:8889/' 'https://presto.nginx-presto-cluster.our-domain.com/';
proxy_pass http://localhost:8889/;
}
Presto 的响应包含一个 nextUri 来获取结果。 sub_filter 将这些 Uri 从 localhost:8889 重写到我们的安全域,在那里它们再次通过 nginx 传递。
问题: 第一个响应的正文看起来完全符合预期:
{
"id":"20171123_104423_00092_u7hmr"
, ...
,"nextUri":"https://presto.nginx-presto-cluster.our-domain.com/v1/statement/20171123_104423_00092_u7hmr/1"
, ...
}
然而,第二个请求看起来像:
{
"id":"20171123_105250_00097_u7hmr"
, ...
, "nextUri":"http://localhost:8889/v1/statement/20171123_105250_00097_u7hmr/2"
, ...
}
我们本来希望重写总是以同样的方式工作。
你能帮我们吗?
【问题讨论】:
标签: emr presto nginx-reverse-proxy