参考:
https://www.cnblogs.com/jinjiangongzuoshi/p/11773070.html
https://github.com/buger/goreplay/wiki/Getting-Started
这篇小记主要是记录gor不支持https流量镜像的一种解决思路
1、在nginx proxy 配置 post_action,实现https流量镜像出http流量到gor
server
{
listen 80;
? ? ? listen? ? ? ?443;
? ? ? server_name? tt.example.com;
? ? ? index index.html index.php;
? ? ? root? /data/web/webclose;
? ? ? location / {
? ? ? ? ? ? expires off;
? ? ? ? ? ? proxy_redirect? ? ?off;
? ? ? ? ? ? proxy_set_header? ?Host? ? ? ? ? ? ?tt.example.com;
? ? ? ? ? ? proxy_set_header? ?X-Real-IP? ? ? ? $remote_addr;
? ? ? ? ? ? proxy_set_header? ?X-Forwarded-For? $proxy_add_x_forwarded_for;
? ? ? ? ? ? proxy_pass https://1.1.1.1:443;
? ? ? ? ? ? post_action @tt_http;
? ? ? }
? ? ? location @tt_http {
? ? ? ? ? ? expires off;
? ? ? ? ? ? proxy_redirect? ? ?off;
? ? ? ? ? ? proxy_set_header? ?Host? ? ? ? ? ? ?tt.example.com;
? ? ? ? ? ? proxy_set_header? ?X-Real-IP? ? ? ? $remote_addr;
? ? ? ? ? ? proxy_set_header? ?X-Forwarded-For? $proxy_add_x_forwarded_for;
? ? ? ? ? ? proxy_pass http://1.1.1.2:8080;
? ? ? }
? ? ? include deny_file.conf;
? ? ? include ssl_gz4399.com.conf;
? ? ? access_log? /data/logs/$host.log? access;
}
2、在1.1.1.2上启动gor 监听8080端口,并将http流量stdout
./gor --http-pprof :8080? --input-raw :8080? --input-raw-realip-header "X-Real-IP"? --output-stdout
nginx post_action+gor实现https流量复制
原文:https://www.cnblogs.com/wshenjin/p/11850386.html