seratch's weblog in Japanese

About Scala, Java and Ruby programming in Japaense. If you need English information, go to http://blog.seratch.net/

別ホストにそのまま redirect する Rack app

こんな config.ru を書いて rackup -D とかしておけばよいですね。

new_hostname = "yetanotherapp"
run lambda { |env|
  request = Rack::Request.new(env)
  Rack::Response.new {|response|
    response.redirect("http://#{new_hostname}#{request.path}")
  }
}