模块 ngx_http_mirror_module
| Example Configuration Directives mirror mirror_request_body |
该ngx_http_mirror_module模块(1.13.4)通过创建后台镜像子请求来实现原始请求的镜像。对镜像子请求的响应将被忽略。
配置示例
location / {
mirror /mirror;
proxy_pass http://backend;
}
location = /mirror {
internal;
proxy_pass http://test_backend$request_uri;
}
指令
| 句法: |
mirror |
|---|---|
| 默认: |
mirror off; |
| 语境: |
http, server,location |
设置将原始请求镜像到的 URI。可以在同一配置级别上指定多个镜像。
| 句法: |
mirror_request_body |
|---|---|
| 默认: |
mirror_request_body on; |
| 语境: |
http, server,location |
指示客户端请求正文是否镜像。启用后,将在创建镜像子请求之前读取客户端请求正文。在这种情况下,由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;
}
