jtrupiano/rack-rewrite — pull request #31 by eliotsykes (2012-04-30 18:05:52+00:00)
Title: :headers option accepts Proc

Hi John,

Thanks for contributing a wonderful Rack middleware to the community. I'm going to be using it to help serve assets with virtual versioned paths and caching headers in a Rails 2.3 app that I'm migrating to Heroku from an Apache+mongrel rig.

This pull request allows the :headers option to accept a Proc which is evaluated at request-time. Previously the :headers option accepted a hash alone, evaluated once at boot time. This change is backwards-compatible and to my eye breaks no existing functionality though I'm happy to be corrected on that.

I'm using this to set my assets Expires headers to consistently be one year in the future.

Tests and docs included in the pull request. If you'd like me to add anything else to the Pull request just let me know.

Thanks again,

Eliot