monkeyWie / proxyee

HTTP proxy server,support HTTPS&websocket.MITM impl,intercept and tamper HTTPS traffic.
MIT License
1.52k stars 567 forks source link

两个请求,一个请求A到hostA 一个请求B请求到hostB, A会请求到hostB #147

Open czl92 opened 3 years ago

czl92 commented 3 years ago
                .serverConfig(config)
                .proxyInterceptInitializer(new HttpProxyInterceptInitializer() {
                    @Override
                    public void init(HttpProxyInterceptPipeline pipeline) {
                        pipeline.addLast(new HttpProxyIntercept() {
                            @Override
                            public void beforeRequest(Channel clientChannel, HttpRequest httpRequest,
                                                      HttpProxyInterceptPipeline pipeline) throws Exception {
                                if (httpRequest.uri().contains("findCompanyList")) {
                                    httpRequest.headers().set(HttpHeaderNames.HOST, "192.168.2.187:10055");
                                    httpRequest.setUri("/reabam-b2b/b2b/findCompanyList");
                                    pipeline.getRequestProto().setHost("192.168.2.187");
                                    pipeline.getRequestProto().setPort(10055);
                                    pipeline.getRequestProto().setSsl(false);

                                }
                                pipeline.beforeRequest(clientChannel, httpRequest);
                            }

findCompanyList正常情况下 只有这个请求会请求到192.168.2.187:10055 现在出现两种情况,要么全都请求到 192.168.2.187:10055,要么请求到原来的host 跟踪了一下代码发现 com.github.monkeywie.proxyee.handler.HttpProxyServerHandlerprivate ChannelFuture cf; 这个属性问题, 这个属性cf.channel().remoteAddress()是 192.168.2.187:10055时候, 正常请求也用这个cf去writeAndFlush所以导致请求有问题

请问有什么办法解决吗?

monkeyWie commented 3 years ago

这个应该是复用了同一个连接导致的,我看看怎么修复吧

tianzhihen521 commented 1 year ago

请问这个bug 会考虑修复吗?

monkeyWie commented 1 year ago

@tianzhihen521 可以修复,等会我发个新版本

tianzhihen521 commented 1 year ago

感谢感谢。

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: monkeyWie @.> 发送时间: 2022年9月16日 18:18 收件人: monkeyWie/proxyee @.> 抄送: changhong @.>, Mention @.> 主题: Re: [monkeyWie/proxyee] 两个请求,一个请求A到hostA 一个请求B请求到hostB, A会请求到hostB (#147)

@tianzhihen521 可以修复,等会我发个新版本

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

monkeyWie commented 1 year ago

已修复:https://github.com/monkeyWie/proxyee/pull/228 等会升级到1.6.8试试