Sam
Sam

Reputation: 321

How to write "transparent" HTTP proxy?

Inspired by this article http://www.catonmat.net/http-proxy-in-nodejs

Any idea, how to convert this proxy to acts as transparent proxy?

PS: I know how to set up my firewall, etc... Just trying to run this toy instead of transparent squid.

Upvotes: 0

Views: 2282

Answers (1)

RomanK
RomanK

Reputation: 1266

In general, the difference between transparent and explicit proxy is that the full URL is not sent in the HTTP command in transparent mode. The proxy would use the Host header to determine the upstream server instead of extracting it from the URL: otherwise the processing is the same. Note that this works for HTTP only, and transparent HTTPS proxy is much harder.

I'm not familiar with node.js: my guess is that the Host header will be available in the request.headers field, and then it's a matter of fixing the proxy_request object to have the proper full upstream URL.

Upvotes: 1

Related Questions