jump to navigation

Track which mongrel handled a request December 26, 2007

Posted by John Dewey in Code, Configuration, Example, Mongrel, Rails, WebServers.

I wrote a plugin which collects system information, and returns the data as HTML comments at the bottom of the page. When running multi-system / multi-Mongrel environments, knowing which server and Mongrel handled a request is paramount.

Unfortunately, getting a handle on this information is difficult, since ‘request.port’, ‘request.env[‘HTTP_HOST’], and ‘request.env[‘SERVER_PORT’], display the origin port, when your Mongrels are behind a reverse proxy.

Ezra clued me into a nice hack.You can add the following code to environment.rb, or in our case the plugin’s init.rb.


No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: