proxymachine icon indicating copy to clipboard operation
proxymachine copied to clipboard

add http headers on the way through

Open ezmobius opened this issue 15 years ago • 3 comments
trafficstars

Is there an existing meachanism(doesn't look like it) for me to add an additional HTTP header to a request I am proxying through proxymachine? Say I am doing something like this:

proxy do |data| p data if data =~ %r{\r\nHost: (.+):?(.+)?\r\n} remote, header = @router.route($1) { :remote => remote, :header => header } else { :noop => true } end end

In order to add something like "X-Foo-Bar: 12.32.23.42\r\n" to the headers being sent to the upstream server? I do not want to change anything else about the request but I'd like to add a header and then let the proxy do its thing.

Would you find this useful if I patched in it to proxymachine? Or do you not want it tied to http at all and should I just run with my own fork?

Thanks -Ezra

ezmobius avatar May 19 '10 20:05 ezmobius

You're trying to add the header to the response you're sending back to the client?

eric avatar Sep 02 '10 21:09 eric

This could be useful in both directions - but that description implies it is being sent back to the client in the response ? (like :reply) but I don't think that is the intent.

michaelneale avatar Nov 28 '10 22:11 michaelneale