mikhailian.mova.org

How to return a custom mime type from a Rails application

Updated 2026-06-17

Add the new mime type to the respective rails initializer

echo "Mime::Type.register \"application/xhtml+xml\", :xhtml" \
  > config/initializers/mime_types.rb

Use the name of this mime type in the config/routes.rb

map.root :controller => "test", :action => 'view', :format => 'xhtml'