17

There is a nice trick to instantly serve contents of a current working directory by HTTP locally:

$ python -m SimpleHTTPServer

This command launches HTTP server at *:8000, serving $PWD contents.

I'm looking for something similar, but for setting up a reverse-proxy.

Something like this:

$ instant-reverse-http-proxy --listen-on 'http://localhost:8000/' --proxy-to 'https://example.com/path'`

So that

$ GET http://localhost:8000/bar

would fetch https://example.com/path/bar.

Any clues?

4 Answers4

10

socat?

# socat TCP-LISTEN:80,reuseaddr,fork,su=nobody TCP:www.dmz.mydomain.org:80

(from lorgor.blogspot and MIT)

# socat -vv OPENSSL-LISTEN:443,cert=cert.pem,cafile=cacert.pem, \
cert=cert.key,reuseaddr,fork TCP4:192.168.34.65:80

(from https://www.buntschu.net/blog/?p=242)

mwfearnley
  • 7,889
8

mitmproxy is a fully fledge proxy and http packet analysis tool. The best I've found so far.

For your use case:

mitmproxy --listen-port 8000 --mode reverse:https://example.com/path
TwidXuga
  • 81
  • 1
  • 1
5

I was faced with the exact same problem and became frustrated with the software that was around (and still am) and so I made proxyboi. Its purpose is to be an instant command-line only proxy without a configuration file. Give it a spin. Hopefully it helps you and others looking for a simple instant reverse proxy.

svenstaro
  • 535
0

Theres a node module for that: https://github.com/cha0s/kiss-proxy. Supports command line arguments and a config file for more complex situations.

Only downside with kiss-proxy is that it looks slightly dated and may not run on newer versions of node.