2

I'm searching for some examples on how to write a proxy in Ruby that supports HTTPS. I have a simple proxy implemented with Webricks HTTPProxyServer, but I noticed, that HTTPS traffic is just tunneling (as it should ;) ). But I want to record the content with VCR (regarding my question here VCRProxy: Record PhantomJS ajax calls with VCR inside Capybara) and as long the content is only tunnled through, VCR can't record it.

So I was thinking of writing the proxy as a man-in-the-middle, generate SSL certificates on the fly (I don't care about certificate errors, its just for testing), and then I would be able to record the content / playback it later.

So if somebody has a good ressource from how to start, or a tutorial or a gist, please let me know.

PS: I have already seen this questions, but they don't provide any further stuff (and it need to be in ruby):

2 Answers 2

3

An old question, but for the sake of completeness here goes another answer.

I've implemented a HTTP/HTTPS interception proxy in Ruby, the project is hosted in github.

The project is new, so it's not (yet) as mature as Python's mitmproxy, but it supports HTTPS with certificates generation on-the-fly.

0
0

There's an excellent MITM proxy in Python aptly named mitmproxy. The netlib library by the author does the tricks and mitmproxy uses it.

The codebase isn't large and it shouldn't be hard to go through it given that you know Ruby.

3
  • I have seen that, but I need the proxy in ruby, because I must wrap a block around the net::http calls for VCR to record it.
    – 23tux
    Nov 20, 2012 at 16:42
  • I was suggesting that you should look at it for reference as your question implied that you were going to implement one in Ruby.
    – user507577
    Nov 20, 2012 at 17:03
  • Thx, I will have a look at this, but my Python isn't very good ;), so when somebody got a ruby example, I would be glad to hear about it
    – 23tux
    Nov 21, 2012 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.