Module ngx_http_mirror_module

ngx_http_mirror_module模块(1.13.4)通过创建后台镜像子请求来实现原始请求的镜像。对镜像子请求的响应将被忽略。

Example Configuration

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

location = /mirror {
    internal;
    proxy_pass http://test_backend$request_uri;
}

Directives

Syntax:mirror uri | off;
Default:mirror off;
Context:http , server , location

设置原始请求将被镜像到的 URI。可以在同一级别上指定多个镜像。

Syntax:mirror_request_body on | off;
Default:mirror_request_body on;
Context:http , server , location

指示客户端请求主体是否已镜像。启用后,将在创建镜像子请求之前读取客户端请求主体。在这种情况下,将禁用由proxy_request_bufferingfastcgi_request_bufferingscgi_request_bufferinguwsgi_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;
}