chobits / ngx_http_proxy_connect_module

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

Client -> nginx reverse proxy -> external forward proxy -> target service possible? #211

Open BenjaminDaSilva opened 2 years ago

BenjaminDaSilva commented 2 years ago

Hi there,

I found some kind of similar questions (166, 210) but in details my scenario is different:

I have a client C (part of a web application) which can't be configured to use a forward proxy for API calls to a service S that can only be reached via a forward proxy F. This web app though runs on a virtual appliance which runs nginx to reverse proxy inbound connections to the web app.

Could I enable this nginx with this module to act as reverse proxy R but not pass_proxy directly to service S but via the forward proxy F?

So basically:

[ C ] ---- API Call ----> [ R ] ----- CONNECT / tunnel ----> [ F ] -----> [ S ]

chobits commented 2 years ago

This is technically feasible. But this module does not support this feature.

It needs a new nginx upstream module to fire CONNECT tunnel request to upstream and then proxy data flow via this tunnel to backend.

According to my nginx-C developing experience, it is hard to modify and debug nginx upstream from its C core base.