Sve*_*cke 9 ruby internet-explorer rack file-type html-components
我想让Rack服务于具有特定内容类型的特定文件.它是一个.htc文件,需要作为text/x-component提供,以便IE识别它.在apache我会做
AddType text/x-component .htc
Run Code Online (Sandbox Code Playgroud)
我怎样才能通过Rack实现这一目标?目前该文件由Rack :: Static提供,但我没有找到设置内容类型的选项.
jig*_*fox 14
您可以config/initializers/mime_types.rb像这样更新:
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Rack::Mime::MIME_TYPES.merge!({
".ogg" => "application/ogg",
".ogx" => "application/ogg",
".ogv" => "video/ogg",
".oga" => "audio/ogg",
".mp4" => "video/mp4",
".m4v" => "video/mp4",
".mp3" => "audio/mpeg",
".m4a" => "audio/mpeg",
".htc" => "text/x-component"
})
Run Code Online (Sandbox Code Playgroud)