Ngx http mirror module

来自Linux78|wiki
Bob讨论 | 贡献2019年12月5日 (四) 10:18的版本 (创建页面,内容为“所述ngx_http_mirror_module模块(1.13.4)实现通过创建背景镜子请求的原始请求的镜像。镜像子请求的响应被忽略。 示例配置 loca…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

所述ngx_http_mirror_module模块(1.13.4)实现通过创建背景镜子请求的原始请求的镜像。镜像子请求的响应被忽略。

示例配置

location / {
   mirror /mirror;
   proxy_pass http://backend;
}

location /mirror {
   internal;
   proxy_pass http://test_backend$request_uri;
}
句法:镜像uri | 关闭;

默认:镜像关闭;

语境:http,服务器,位置

设置将镜像原始请求的URI。几个镜像可以在同一层上指定。

句法:mirror_request_body开启| 关闭;

默认:mirror_request_body on;

语境:http,服务器,位置

指示是否镜像客户端请求主体。启用后,将在创建镜像子请求之前读取客户端请求主体。在这种情况下,由proxy_request_buffering,fastcgi_request_buffering,scgi_request_buffering和uwsgi_request_buffering指令设置的未经缓冲的客户端请求正文代理将被禁用。

location / {
   mirror /mirror;
   mirror_request_body off;
   proxy_pass http://backend;
}

location /mirror {
   internal;
   proxy_pass http://log_backend;
   proxy_pass_request_body off;
   proxy_set_header Content-Length "";
   proxy_set_header X-Original-URI $request_uri;
}