Hi,

I'm not sure but open-uri may follow the redirection.

I am using net/htp class to follow the URL redirection. An sample code is

require 'uri'
require 'net/http'

url = "http://sample.com/..."

max_follow = 5
max_follow.times{
  uri = URI.parse(url)
  response = nil
  Net::HTTP.start(uri.host, uri.port) {|http|
    response = http.head(uri.request_uri)
  }
  break unless response.key?("Location")
  url = response['Location']
}

Thank you.