Thursday, April 17, 2008

Useful information in the request

Sometimes I have to extract some information from the incoming HTTP request. Most often I might need it for usage reports like browser or referring websites, etc. Here are some common bits I use:
Browser and OS => request.env['HTTP_USER_AGENT']
Referring website => request.env["HTTP_REFERER"]
IP => request.remote_ip
Session id => session.session_id

No comments: