Set content type header with rails and apache

I want to send the generated view as a kml file with the necessary headers (content type and file expire) ... using the head gives 500, and using response.headers does not affect ...

What should I do?

+3
source share
2 answers
+11
source

You will need to register the KML Mime type. In your config/initializers/mime_types.rb

Mime::Type.register "application/vnd.google-earth.kml", :kml 

Then in your action you can do:

format.kml { ... }

KML Tutorial: http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server

0
source

Source: https://habr.com/ru/post/1786985/


All Articles