proxymachine
proxymachine copied to clipboard
add http headers on the way through
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
You're trying to add the header to the response you're sending back to the client?
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.