chobits / ngx_http_proxy_connect_module

A forward proxy module for CONNECT request handling
BSD 2-Clause "Simplified" License
1.82k stars 496 forks source link

Does this module keep/maintain http connections between nginx and target service? #195

Open chasehan-atlas opened 3 years ago

chasehan-atlas commented 3 years ago

Hey, I am using this module with nginx as a forward proxy to forward my https requests.

I can see "Proxy-Connection: Keep-Alive" when I followed curl example on README. Does it mean this module would keep http connection until it reaches proxy_connect_connect_timeout value?

My plan is "my service" ------call------->" nginx as forward proxy" -----call----> "Target service". But I am not sure ngx_http_proxy_connect_module would keep http connection between Nginx and the target service or Nginx supports keepalive natively. (From nginx doc, nginx as reverse proxy supports keepalive_requests. Not sure keepalive are also supported after patch this module)

How did I test it: I built a nginx docker image with this module and run it on my local with port 8088. Then I use curl command curl https://github.com/ -v -x 127.0.0.1:8088 After execution, the log shows Closing connection 0 at the end. Then if I run that curl command again, it would establish http porxy tunnel again and it also did TSL handshake. But if I use curl --next to call same endpoint twice in one command, the second call would re-use http connection. The command looks like this: curl https://github.com/ -Iv -x 127.0.0.1:8088 --next https://github.com/ -Iv -x 127.0.0.1:8088

I am wondering how can I keep the http connection during each request? Any ideas about that or any suggestions? Thank you.

Chase

gdubicki commented 3 weeks ago

I think this is partially answered by https://github.com/chobits/ngx_http_proxy_connect_module/issues/107#issuecomment-496908828, but I would appreciate a full and clear answer from the maintainers too.