Closed DeoLeung closed 1 year ago
my question is , is it possible to forward the Proxy-Authorization header to backend for every subsequence requests? or it's there any hacky way to carry this information for every tunneled requests?
Unfortunately, this module does not support this feature. The data sent through the established CONNECT tunnel is transmitted transparently between the client and the endpoint. In theory, it is not possible to determine the specific protocol being used, as the CONNECT tunnel protocol is too simple to allow for explicit detection of the specific protocol being used.
But in practice people usually use this tunnel to proxy SSL data flow, and if you have already known the data flow over the tunnel is SSL protocol, you can unpack it and insert the "Proxy-Authorization" header. You can do it in your listen 443 ssl - server_name ok.com
server, or you can add an addtional nginx reverse server to do this between [nginx connect]
and [nginx reverse proxy]
as long as your intermediate proxy can hold the correct SSL certificate. The key problem is how to decrypt the SSL stream, however, this method may not work for commercial websites, as obtaining their SSL certificates may not be possible.
yes, using a self-signed certificate now I can process the proxied ssl data for known sites. (though I need to set unverified in http client, but it's ok for internal server or cli use)
from my testing, it's now impossible to add the proxy-authorization(notice it's not a fixed user/password, it's dynamic I want it to be checked in backend
), as the information is only visible in connect (server 80), server 443 won't receive it. so I just wonder is it possible to add some extra variable through the tunnel from 80 to 443.
anyway I can let the client explicit carry the information for now. If we could figure out a way to carry this information from connect
, will be much better :)
yes, using a self-signed certificate now I can process the proxied ssl data for known sites. (though I need to set unverified in http client, but it's ok for internal server or cli use)
from my testing, it's now impossible to add the proxy-authorization(notice it's not a fixed user/password, it's dynamic I want it to be checked in
backend
), as the information is only visible in connect (server 80), server 443 won't receive it. so I just wonder is it possible to add some extra variable through the tunnel from 80 to 443.anyway I can let the client explicit carry the information for now. If we could figure out a way to carry this information from
connect
, will be much better :)
If you want to do this in proxy_connect module, it is very complicated to implement, especially developing the logic to unpack data flow and insert additional information, all your need to do is to implemnt a new SSL server. And meanwhile, you cannot get some information from the data flow (like unpacking and reading information from the proxied data flow).
That's why it is easy to add an nginx proxy between [nginx connect]
and [nginx reverse proxy]
, you use the lua-nginx-module to modify the data flow (HTTP requests) dynamically
on that intermediate nginx proxy.
I'm having the following config
using curl
I'm using this route to add some processing of the request before it's sent to the real site. so the client user don't need to modify the request, just add a proxy, we could inject some credential and audit and send it out.
my question is , is it possible to forward the
Proxy-Authorization
header tobackend
for every subsequence requests? or it's there any hacky way to carry this information for every tunneled requests?Also, is there any improvement I can make for this route, currently I need to self-signed a ca and have my client disable verification, something like
verify=False
.