首页 > Web开发 > 详细

nginx post_action+gor实现https流量复制

时间:2019-11-13 17:37:16      阅读:288      评论:0      收藏:0      [点我收藏+]

关于gor:

参考:

https://www.cnblogs.com/jinjiangongzuoshi/p/11773070.html

https://github.com/buger/goreplay/wiki/Getting-Started

这篇小记主要是记录gor不支持https流量镜像的一种解决思路

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!