Rails アプリでは、画像を返す必要があります。
次のように、ルートに 1x1.gif トラッキング ピクセルがあります。
match "/_ctrack.gif" => "email_tracking_pixels#my_method"
コントローラーで:
def my_method
send_data open('https://www.xxxxxx.com/images/1x1_transparent.gif') {|f| f.read }, :filename => '1x1_transparent.gif', :type => 'image/gif'
end
問題は、何らかの理由でこれがタイムアウトになることがあるということです。次のエラーで:
2011-03-07T20:08:36-08:00 heroku[router]: Error H12 (Request timeout) -> GET www.xxxxxxx.com/images/1x1_transparent.gif dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-03-07T20:08:36-08:00 app[web.1]:
2011-03-07T20:08:36-08:00 app[web.1]: OpenURI::HTTPError (503 Service Unavailable):
2011-03-07T20:08:36-08:00 app[web.1]: app/controllers/email_tracking_pixels_controller.rb:19:in `my_method'
2011-03-07T20:08:36-08:00 app[web.1]: lib/rack/www.rb:7:in `call'
ローカルに保存されているこの画像を渡す方法と、 open を使用して自分のサーバーに Web コールバックを行う方法についてのアイデアはありますか?
ありがとう