LoginSignup
0
0

More than 5 years have passed since last update.

https、no-cache、IE8以前で特定のcontent-typeが表示・ダウンロードできない件の対応

Posted at

https、no-cacheに設定しているとIE8以前のブラウザで特定のcontent-typeの場合に警告が出て表示できなかったりします。そんな場合は、下記のようにヘッダ情報をcache有効に設定すると表示・ダウンロード等ができるようになります。

sample_controller
   def hoge
        response.headers['Cache-Control'] = 'public'
        response.headers['Pragma'] = 'public
   end

キャッシュさせるとまずい場合は、view側でランダムなクエリストリングをつけるようにすると良いでしょう。
ruby: sample.erb
= link_to 'ダウンロード', sample_hoge_path(s: SecureRandom.uuid)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0