I wish to send a produced view like a kml file, using the necessary headers(content-type and file expires in)... using mind provides a 500, and taking advantage of response.headers doesn't have effect...

What must i do?

You'd have to register the KML mime type. :content_type

render

Then inside your action that you can do:

In your config/initializers/mime_types.rb

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