我们正在使用nginx在AWS presto群集前提供安全层。我们为nginx-presto-cluster.our-domain.com
注册了SSL证书使用基本身份验证通过nginx传递presto请求。 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"
, ...
}
我们希望重写能够始终以相同的方式工作。
你能帮助我们吗?
答案 0 :(得分:0)
我们通过添加
解决了这个问题proxy_set_header Accept-Encoding "";
进入上面的配置代码段。
原因是如果启用了流量,流量可能会在流程中被压缩。 然后,字符串替换将不适用于压缩内容。
如果不接受任何编码,我们会阻止此压缩。