[Mongrel] Slightly OT: Rails + Mongrel Proxy Server without Apache

Chad Woolley thewoolleyman at gmail.com
Thu Jan 4 15:22:51 EST 2007


I'm looking for suggestions on the simplest way to implement an HTTP
proxy under Rails/Mongrel.  It should preserve ALL of the proxied HTTP
response - including all header content such keepalives, etc.

Yes, I know I can do this with Apache's proxy module, and we already
do that for the non-development/test environments.  This is just for
the development/test environment where we don't run Apache, just

Background:  This is to support the usage of the Jspell AJAX-based
spellchecker tool.  This requires AJAX requests to be made to the
JSpell server, which is a Java servlet.  However, since it's AJAX, the
responses from the JSpell server must be served from the same host as
the rest of the rails app (whether or not this is absolutely
necessary, it's a hardcoded requirement in the obfuscated jspell
javascript).  We've tried to write a Rails controller which uses
Net::HTTP to make the call to the proxied Jspell server, then maually
build a response.  However, this approach always seems to result in
invalid response headers that the Jspell javascript doesn't like.  My
guess is that it's something do to with the keepalive not being
settable, as discussed here:


So, what I want is to simply proxy the entire response, headers and
all, without rails or mongrel changing anything.

Any ideas?

Thanks in advance,
-- Chad Woolley

More information about the Mongrel-users mailing list