alibaba / anyproxy

A fully configurable http/https proxy in NodeJS
http://anyproxy.io
Apache License 2.0
7.85k stars 1.22k forks source link

作为node模块,用pm2启动时,如果是cluster模式,即使只有一个进程,也无法代理https请求 #196

Open khejing opened 7 years ago

khejing commented 7 years ago

Which platform are you running AnyProxy

linux

The version of the AnyProxy

3.10.3

Your expected behavior of AnyProxy

https代理可以正常使用

The actual behavior of AnyProxy

https代理无法正常使用,访问两下就会出错

The log of the error

1|wechat-c | received https CONNECT request mp.weixin.qq.com 1|wechat-c | ==>will forward to local https server 1|wechat-c | err when connect to + mp.weixin.qq.com , Error: connect ECONNREFUSED 127.0.0.1:40002

netstat -antp可以看到: tcp6 0 0 :::40001 ::: LISTEN 2932/.pm2) tcp6 0 0 :::8001 ::: LISTEN 2932/.pm2) tcp6 0 0 :::40002 ::: LISTEN 2932/.pm2) tcp6 0 0 :::8002 ::: LISTEN 2932/.pm2)

http代理没有问题。如果把pm2的启动模式指定为fork模式,也没有问题

codingfishman commented 7 years ago

@khejing 谢谢反馈,请帮忙确认,在PM2的cluster模式下,PM2自己会不会对端口做转发? AnyProxy所监听的40002端口,是不是被PM2先进行了拦截,导致最后没有到AnyProxy上面