I have a specific file in my app that I need to return as a mime type of text/cache-manifest
. The rest should be served just like grunt-contrib-connect normally does. Is it possible to configure grunt-contrib-connect this way? If I had to guess, it would have something to do with the middleware but I don't see an example of how to do this.
If anyone cares why I need this, it's because I've got a static html5 webapp, and I need to force it to be cached on my iPad. To do that, I need to follow these directions: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/Client-SideStorage/Client-SideStorage.html
You shouldn't need to configure the mime type. Your file should have an extension of .manifest or .appcache and it will be served correctly.
I tested using curl -I http://mymac.local:9000/page.manifest
on the terminal with OS X and here is how my connect server responded:
HTTP/1.1 200 OK
Accept-Ranges: bytes
ETag: "1760-1380731109000"
Date: Thu, 03 Oct 2013 14:34:01 GMT
Cache-Control: public, max-age=0
Last-Modified: Wed, 02 Oct 2013 16:25:09 GMT
Content-Type: text/cache-manifest; charset=UTF-8
Content-Length: 1760
Connection: keep-alive
Notice the line indicating the connect server is already responding with the correct Content-Type.
btw - I'm running connect server from a yeoman generated gruntfile for angular so I'm not sure whether it has provided something nonstandard.
Can you try the curl command and let me know if your Content-Type is correct? What is the extension for your file?