greim / hoxy

Web-hacking proxy API for node
http://greim.github.io/hoxy/
MIT License
599 stars 97 forks source link

question #91

Closed Octolus closed 7 years ago

Octolus commented 7 years ago

I want to forward https://domain.com full request to a http proxy server ( http://127.0.0.1:80)

how would i do that? any examples on this? :)

it would basically forward the full request, then get the return from the server.. the return as in response only, not headers.

Octolus commented 7 years ago

I guess this is what I'm supposed to use. domain.tld is what i want to "hijack" the traffic of into my own proxy server.

var hoxy = require('hoxy');
var proxy = hoxy.createServer({
  upstreamProxy: '127.0.0.1:80',
  reverse: 'https://domain.tld',
  certAuthority: { key, cert },
  tls: { key, cert },
  slow: { rate, latency, up, down }
});
greim commented 7 years ago

So basically a conditional flow like this?

browser => hoxy => yourProxy => domain.tld  # if domain.tld
browser => hoxy => otherDomain.tld          # otherwise

Unfortunately Hoxy doesn't have a built-in way to do this. The example above would forward to the upstream proxy no matter which domain.

The reverse option just tells Hoxy where to forward traffic if you visit the proxy directly (rather than configuring your client to use it as a proxy).