Variables In Request Env - Ruby on Rails

request.env is a Ruby Array that contains information about a visiting user’s and server environments.
request.env is accessible on all pages hosted in a ruby on rails site. The Array contains the following key/value pairs:

  • SERVER_NAME
  • PATH_INFO
  • REMOTE_HOST
  • HTTP_ACCEPT_ENCODING
  • HTTP_USER_AGENT
  • SERVER_PROTOCOL
  • HTTP_CACHE_CONTROL
  • HTTP_ACCEPT_LANGUAGE
  • HTTP_HOST
  • REMOTE_ADDR
  • SERVER_SOFTWARE
  • HTTP_KEEP_ALIVE
  • HTTP_REFERER
  • HTTP_COOKIE
  • HTTP_ACCEPT_CHARSET
  • REQUEST_URI
  • SERVER_PORT
  • GATEWAY_INTERFACE
  • QUERY_STRING
  • REMOTE_USER
  • HTTP_ACCEPT
  • REQUEST_METHOD
  • HTTP_CONNECTION

For testing purposes it might be useful to print out a table with the request.env information in it.

<% for item in request.env %>

<% end %>

key Value
<%= item[0] %> <%= item[1] %>