ngx_http_mirror_module 模块
| 配置示例 指令 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;
}