模块 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;
}
