Custom Content-Type for File in Rails 'public' Folder

Posted by Kevin Sylvestre on Stack Overflow See other posts from Stack Overflow or by Kevin Sylvestre
Published on 2010-04-15T15:41:25Z Indexed on 2010/04/15 15:43 UTC
Read the original article Hit count: 188

Filed under:

For assets stored in the 'public' folder of a ruby-on-rails application is it possible to change the 'Content-Type' when running 'script/server'? For example, I am attempting to create an HTML5 application supporting offline mode, and have an 'offline.manifest'. When I run:

curl -I localhost:3000/offline.mainfest

The following header information is returned:

HTTP/1.1 200 OK
...
Content-Type: text/plain
...

However, HTML5 specifications require:

HTTP/1.1 200 OK
...
Content-Type: text/cache-manifest
...

© Stack Overflow or respective owner

Related posts about ruby-on-rails