I'm looking for a way to simply set up a proxy locally that connects to a remote site. I don't want to install anything in the system proper. If I could call it with a single command-line call rather than mucking with even a single config file, that would be brilliant.
The purpose is to sniff the traffic between my local app, which I am developing, and the remote server, which someone else is providing and which uses HTTPS.
Preferably it would be a Ruby, Python or Node package, so that I could just do something along the lines of:
mkdir simplest-proxy; cd simplest-proxy; bundle init echo "gem 'simplest-proxy'" >> Gemfile; bundle --path vendor/bundle bundle exec bin/simplest-proxy -p 8080 https://remote.site.example.com/
or
virtualenv simplest-proxy; cd simplest-proxy bin/easy_install simplest-proxy bin/simplest-proxy -p 8080 https://remote.site.example.com/
or
mkdir simplest-proxy; cd simplest-proxy npm install simplest-proxy node_modules/.bin/simplest-proxy -p 8080 https://remote.site.example.com/
It would allow my app to connect to localhost:8080
, which would forward the request (and rewrite the Host
header and whatever else necessary) to the remote site. I would be able to watch lo
in WireShark and find out what's going on.
I've had a quick look around in pypi, rubygems and npm, but what I found so far was either not working (proxylet
, which otherwise looked very promising), intended for a much more complicated scenario and requiring setup (dj-revproxy
) or expecting to be called with a correct Host
(node-reverse-proxy
) rather than rewriting.
UPDATE: I'm going with an Apache with a ProxyPass
/ ProxyPassReverse
config for now, but it feels massively overkill and requires playing with config files.
UPDATE: Another solution that is not applicable is an actual HTTP proxy rather than one emulating the remote site. Because the remote site is an HTTPS site, that would just make my app do a CONNECT within the proxy and nothing has been gained.
NGINX Plus and NGINX are the best-in-class reverse proxy and load balancing solutions used by high-traffic websites such as Dropbox, Netflix, and Zynga.
For example, if a user in Paris visits a reverse-proxied website with web servers in Los Angeles, the user might actually connect to a local reverse proxy server in Paris, which will then have to communicate with an origin server in L.A. The proxy server can then cache (or temporarily save) the response data.
Why is the Nginx webserver called a "reverse proxy"? "Reverse proxy" refers to a specific function that a specific Nginx instance can take on. Other Nginx instances can be ordinary web servers, or mail proxies or even load balancers (which often refers to "reverse proxy across multiple servers").
A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.
Found http://mitmproxy.org/ !
My use case is covered by:
mitmproxy -p 8080 -P https://remote.site.example.com/
But there's more. It also offers an ncurses UI for showing all requests done, and allows you to inspect them. This makes WireShark unnecessary.
Install with your distro package installer or with easy_install as shown in the question:
virtualenv mitmproxy; cd mitmproxy bin/easy_install mitmproxy bin/mitmproxy -p 8080 -P https://remote.site.example.com/
Edit:
For mitmproxy version 3, the arguments would be:
mitmproxy -p 8080 --mode reverse:https://remote.site.example.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With