This is a really simple question, but I cannot find any mention of this, anywhere..
How do I get the client’s IP address from in Sinatra?
get '/' do
"Your IP address is #{....}"
end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sinatra provides a
requestobject, which is the interface to the client request data that you should be using.Using
request.ipis the preferred method to find the client’s IP address: