# Ruby webrick/httpproxy and headers

**URL:** <https://www.ruby-forum.com/t/ruby-webrick-httpproxy-and-headers/172357>\
**Category:** Ruby\
**Created:** [July 20, 2009, 7:01am UTC](https://www.ruby-forum.com/t/ruby-webrick-httpproxy-and-headers/172357 "2009-07-20T07:01:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![null0x80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@null0x80](https://www.ruby-forum.com/u/null0x80)\
**Post date:** [July 20, 2009, 7:01am UTC](https://www.ruby-forum.com/t/ruby-webrick-httpproxy-and-headers/172357/1 "2009-07-20T07:01:37Z")

</div>

I’ve been trying to get some sort of confirmation or examples on this  
all day and have so far had no luck.

Using the webrick httpproxy class(?) I have been trying to get it so  
that on certain sites when they are visited though the proxy I am able  
to replace the cookie being sent so that the site loads the correct  
details for everyone that uses the proxy.

I was able to get this sorta working using the “Net::HTTP” class, but  
the problem with that is that it’s not really a proxy. I was using it as  
a servlet so that when I went to my local machine in the browser it  
would launch the servlet code and goto the site and display it correctly  
in my browser. It would however still show the original sites URL in the  
links, which I was able to replace as well, but then it kept getting  
more and more complicated. And in the future I would like to have  
support for more than 1 site without having a bunch of different  
settings in place to get them all working correctly.

I found a similar type of ruby code at  
[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142072](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142072) which  
I see is able to delete and add headers but when trying to add the  
cookie header it didn’t produce any other results. So that is also why  
I’m not even sure if the proxy can replace the cookies.

I’m still kinda new to ruby and have been able to make it this far but  
using the proxy class is a bit confusing for me. If anyone has any other  
recommendations on a different proxy class or anything like that, then  
that would be awesome.  
Thanks. 🙂
