add http headers on the way through #4

Open
ezmobius opened this Issue May 19, 2010 · 2 comments

Projects

None yet

3 participants

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

eric commented Sep 2, 2010

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment