From: dusty Date: 2008-02-06T11:35:03+09:00 Subject: Re: simple ruby proxy server? Well, this will work to record the headers. You'll need to install the mongrel gem. # gem install mongrel # headerlog.rb require 'rubygems' require 'mongrel' require 'logger' class HeaderHandler < Mongrel::HttpHandler @@logger = Logger.new('headers.log') def process(request,response) response.start(200) do |head, out| head["Content-Type"] = "text/plain" @@logger.info request.params end end end server = Mongrel::HttpServer.new("127.0.0.1", "2222") server.register("/", HeaderHandler.new) server.register("/favicon.ico", Mongrel::Error404Handler.new("")) server.run.join --- Then run it # ruby headerlog.rb Its set to listen on port 2222 and will record all the headers to a file named headers.log. You could change that port to whatever you want. I see no security implications of listening on port 80. The only problem would be if you have something else listening on port 80. Are you trying to put something in front of an existing application to capture the headers, then have it proxy the request to something else? In that case, what kind of application is it? You might be able to do that in the app itself. Or, perhaps turn on some sort of debug logging in apache or whatever server you are using. I might have some other ideas if this is more complex than the simple example I listed above. Hope that is helpful.