mmcgrana/ring — Issue #42: Allow headers map/function for wrap-file?
Author: jarrett
Created: 2011-11-17 04:17:09+00:00
State: open

Setting headers, particularly cache-control, can be very important when serving static files. This is especially true in an environment like Heroku, where you're relying on a server-side HTTP cache to keep app requests down.

I propose a simple and flexible solution: supporting a new key in opts called `:headers`. You can pass in a function or a map.

If you pass in a map, then that becomes the headers map.

If you pass in a function, then the function will receive the path along with `opts`. The developer-supplied function must return a map of headers. The purpose of allowing a function is to provide the greatest possible flexibility. (Developers may want to set headers differently depending on the path.)

Sorry that I don't have time to write a patch now. I just wanted to pass this idea along. Thanks!