Re: Dynamically proxy broadway traffic

Replying to myself ...

I've gotten a proof-of-concept of this working :) I switched to
another proxying codebase, as it was easier to modify for my purposes.
I've written a blog post about it, including some example code:


On Fri, Sep 16, 2016 at 3:10 PM, Daniel Kasak <d j kasak dk gmail com> wrote:
Hi all.

This question is mildly off-topic, but on the other hand I assume it
would also be of great interest to people here. I'm trying to set up a
reverse proxy for broadway ( gtk's html5 backend ) traffic. The idea

1) The browser hits a login page, which is regular html. After a login
is successful, a new broadwayd process is launched, and a new instance
of a gtk app is launched. The port that broadway is running on is
stored in a hash "somewhere", and a cookie is set containing the key.

2) The browser is redirected to the reverse proxy. The proxy inspects
the request ( eg passes it to HTTP::Request ) and pulls out the key.
It then checks in the broadway mapping hash to see if this is a valid
key/port. If so, it proxies all traffic from this browser to the
correct port; if not, they're redirected to the login page.

All of this could then sit behind an nginx https proxy, providing
secure access for multiple remote clients to gtk+ apps :)

I've implemented part 1. For part 2, I've been trying to figure out
how to adapt the code:

This code ( it's very concise ) actually works perfectly for proxying
broadway traffic ... to a static port. I've been trying to get my head
around how I'd intercept the 1st bit of traffic - unfortunately, the
way this example code is written, the connection to the backend is
opened before we start reading. Can anyone see how to do this? Am I
approaching it the right by ( ie using this example code )? Maybe
there's an easier way?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]