Sergio Tapia Sergio Tapia - 4 months ago 6
Ruby Question

What does location mean in my Rails logs?

Here's an example output:


13:25:29 log.1 | method=GET path=/users/auth/github/callback
format=html controller=users/omniauth_callbacks action=github
status=302 duration=829.94 view=0.00 db=25.57
location=http://loclhost:5000/heroku/in-stcks/
params={"code"=>"xxxxxxxx",
"state"=>"xxxxxxxx"}


What is the
location
field in this line, and where is it loaded from?

Answer

I believe you are using the lograge gem for logging. There, the location field is set if the request was answered with an HTTP redirect (i.e. an HTTP 301 or HTTP 302). The field contains the full URL where the user was forwarded to.

The field is called location because that's the name of the HTTP header containing this field in the response.