If http://foo.com redirects to 1.2.3.4 which then redirects to http://finalurl.com, how can I use Ruby to find out the landing URL \"h
http://foo.com
1.2.3.4
http://finalurl.com
for JRuby this worked
JRuby
def get_final_url (url) final_url = "" until url.nil? do final_url = url url = Net::HTTP.get_response(URI.parse(url))['location'] end final_url end